-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
***Here is my Code
#!/usr/bin/python2.7
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
client = ModbusClient(method='rtu', port='/dev/ttyS1',
stopbits=1, bytesize=8, timeout=0.3,
baudrate=19200)
client.connect()
debug=True
#enable hardware handshake IMPORTANT
client.socket.rtscts=True
#specify which slave you want to talk to
myUnit=1
#read Version
reg = client.read_holding_registers(0,1, unit = myUnit)
print reg
print reg.registers
client.close()
***The output
None
Traceback (most recent call last):
File "test12.py", line 22, in
print reg.registers
AttributeError: 'NoneType' object has no attribute 'registers'
The code is working I guess but not able to extract the data!
Help needed!
Metadata
Metadata
Assignees
Labels
No labels