Example scripts for the Python GEX library

test_dongle.py 726B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/env python3
  2. import time
  3. import gex
  4. # test with the radio gw
  5. with gex.DongleAdapter(gex.TrxRawUSB(remote=True), 0x10) as transport:
  6. # with gex.TrxRawUSB() as transport:
  7. # connect GEX client library to the remote slave
  8. client = gex.Client(transport)
  9. while True:
  10. client.query_raw(type=gex.MSG_PING)
  11. print("ok")
  12. time.sleep(0.1)
  13. # do = gex.DOut(client, "led")
  14. # adc = gex.ADC(client, "adc")
  15. #
  16. # while True:
  17. # do.toggle(confirm=True)
  18. # print(adc.read_smooth())
  19. # time.sleep(0.2)
  20. # adc = gex.ADC(client, "adc")
  21. # for j in range(10):
  22. # try:
  23. # print(adc.read_smooth())
  24. # except:
  25. # print("Failed")