dam112 changes

This commit is contained in:
2019-07-06 23:27:26 +01:00
parent 2ba9f83569
commit 761a1b35e9
6 changed files with 95 additions and 8 deletions

19
snippets/test6c.py Normal file
View File

@ -0,0 +1,19 @@
from pymodbus.client.sync import ModbusSerialClient
import RS485Ext
import time
ser=RS485Ext.RS485Ext(port='/dev/ttyAMA0', baudrate=1200, stopbits=1)
client = ModbusSerialClient(method='rtu')
client.socket = ser
client.connect()
try:
# result = client.write_register(address=0x0000, unit=4, value=1)
result = client.write_coil(address=0x0000, unit=4, value=1)
print(result)
except Exception as e:
print("ERROR: %s" % str(e))
client.close()