added modbusTester

This commit is contained in:
Nico Melone
2023-09-06 17:13:01 -05:00
parent 15b67fc2c9
commit 0d3ac9045c
2 changed files with 12 additions and 0 deletions

BIN
.DS_Store vendored

Binary file not shown.

12
piflow/modbusTester.py Normal file
View File

@@ -0,0 +1,12 @@
import minimalmodbus
minimalmodbus.BAUDRATE = 9600
minimalmodbus.STOPBITS = 1
instrument = minimalmodbus.Instrument('/dev/ttyS0', 1) #device, modbus slave address
instrument.debug = True
try:
value = instrument.read_float(599) #register -1 for float
print("Value: {}".format(value))
except Exception as e:
print("Error: {}".format(e))