dongle demo update

master
Ondřej Hruška 7 years ago
parent 8469da3f27
commit 91a8269e98
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 4
      gex/transport.py
  2. 14
      test_dongle.py
  3. 6
      test_ini.py

@ -54,8 +54,8 @@ class DongleAdapter(BaseGexTransport):
self.gw_reset()
self.gw_add_nodes([slave])
print('Gateway network ID: ' +
'.'.join(['%02X' % x for x in self.gw_get_net_id()]))
print('Dongle network prefix: ' +
':'.join(['%02X' % x for x in self.gw_get_net_id()]))
def _handleRx(self, frame):
if len(frame) != 64:

@ -4,14 +4,22 @@ import time
import gex
with gex.DongleAdapter(gex.TrxRawUSB(remote=True), 0x10) as transport:
# with gex.TrxRawUSB() as transport:
# connect GEX client library to the remote slave
client = gex.Client(transport)
do = gex.DOut(client, "led")
adc = gex.ADC(client, "adc")
while True:
do.toggle(confirm=True)
print(adc.read_smooth())
time.sleep(0.2)
print(adc.read_raw())
# this will fail unless the communication works
# adc = gex.ADC(client, "adc")
# for j in range(10):
# try:
# print(adc.read_smooth())
# except:
# print("Failed")

@ -3,5 +3,7 @@ import time
import gex
with gex.Client(gex.TrxRawUSB()) as client:
print(client.ini_read(1))
# with gex.Client(gex.TrxRawUSB()) as client:
with gex.DongleAdapter(gex.TrxRawUSB(remote=True), 0x10) as transport:
client = gex.Client(transport)
print(client.ini_read(0))

Loading…
Cancel
Save