dongle demo update
This commit is contained in:
+2
-2
@@ -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:
|
||||
|
||||
+12
-4
@@ -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")
|
||||
|
||||
print(adc.read_smooth())
|
||||
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")
|
||||
|
||||
+4
-2
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user