Skip to content

Instantly share code, notes, and snippets.

@agutenkunst
Created September 10, 2019 10:00
Show Gist options
  • Save agutenkunst/bf549cfcc0acca6faffe83f7788d7c16 to your computer and use it in GitHub Desktop.
Save agutenkunst/bf549cfcc0acca6faffe83f7788d7c16 to your computer and use it in GitHub Desktop.
python read modbus registers
# Requireds: "sudo apt-get install python-pymodbus"
from pymodbus.client.sync import ModbusTcpClient
client = ModbusTcpClient('192.168.0.10')
result = client.read_holding_registers(975,1) # Reads 1 register starting at 975
print(result.registers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment