Added script query_device.py
This commit is contained in:
@@ -67,7 +67,7 @@ print(f'Baudrates: {baud}')
|
||||
print('---- Looking for device ----')
|
||||
total_devices = 0
|
||||
tried_devices = 0
|
||||
CO2_addr = Sensor.input_register_offset['CO2_addr']
|
||||
CO2_offset = Sensor.input_register_offset['CO2']
|
||||
for a in addr:
|
||||
for b in baud:
|
||||
print(f'Address {a : >3} baud {b : >6}: ', end='')
|
||||
@@ -82,7 +82,7 @@ for a in addr:
|
||||
instrument.mode = minimalmodbus.MODE_RTU # rtu or ascii mode
|
||||
instrument.clear_buffers_before_each_transaction = True
|
||||
##
|
||||
CO2 = instrument.read_register(CO2_addr, 1, functioncode=4) * 10
|
||||
CO2 = instrument.read_register(CO2_offset, 1, functioncode=4) * 10
|
||||
print('DEVICE RESPONDED')
|
||||
total_devices += 1
|
||||
except minimalmodbus.NoResponseError:
|
||||
|
||||
Reference in New Issue
Block a user