开发者

AttributeError: 'ModbusIOException' object has no attribute 'bits'

开发者 https://www.devze.com 2022-12-07 18:42 出处:网络
from pymodbus.client import ModbusTcpClient PLC_IP = \'192.168.0.200\' PLC_PORT = 502 client = ModbusTcpClient(PLC_IP, PLC_PORT)
from pymodbus.client import ModbusTcpClient

PLC_IP = '192.168.0.200'
PLC_PORT = 502
client = ModbusTcpClient(PLC_IP, PLC_PORT)
status = client.connect()
print(status)
result = client.read_coils(1,5)
if result.bits[0] == True:
    print("Hello world")
client.close()

It shows the error I put in the title. I recently changed my pc and I think it might be my pymodbus version. Thanks and I wish to have luck finding a solution to my prob开发者_如何学Pythonlem.

0

精彩评论

暂无评论...
验证码 换一张
取 消