1'''
2Modbus_master - write_multi_coils.py.
3
4""" Write a series of 10 discrete coils 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
19coil_list = [1, 0, 1, 1, 0, 0, 1, 1, 1, 0]
20
21## Open Modbus master
22pywpc.ModbusMaster_open(host_ip, salve_id)
23
24## Write multi bits in modbus address 0
25status = pywpc.ModbusMaster_writeMultiCoils(address, coil_list)
26
27print(status)
28
29## Close Modbus master
30pywpc.ModbusMaster_close()