1'''
2Modbus_master - write_coil.py.
3
4""" Write single coil to 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
19value = True
20
21## Open Modbus master
22pywpc.ModbusMaster_open(host_ip, salve_id)
23
24## Write 1 bits in modbus address 0
25status = pywpc.ModbusMaster_writeCoil(address, int(value))
26
27print(status)
28
29## Close Modbus master
30pywpc.ModbusMaster_close()