Read_discrete input

 1'''
 2Modbus_master - read_discrete_input.py.
 3
 4""" Read discrete input from the slave device. """
 5
 6For other examples please check:
 7    https://github.com/WPC-Systems-Ltd/WPC_Stand-alone_Python_release/tree/main/examples
 8
 9Copyright (c) 2024 WPC Systems Ltd.
10All rights reserved.
11'''
12
13## WPC
14import pywpc
15
16host_ip = ""
17salve_id = 1
18address = 0
19coils = 10
20
21## Open Modbus master
22pywpc.ModbusMaster_open(host_ip, salve_id)
23
24## Read 10 bits (= coils) at address 0, store result in coils list
25coils_l = pywpc.ModbusMaster_readDiscreteInputs(address, coils)
26
27print(coils_l)
28
29## Close Modbus master
30pywpc.ModbusMaster_close()