write coil

This commit is contained in:
aarizona 2024-08-10 09:57:10 +03:00
parent 0136e173a1
commit 71e87c7034
1 changed files with 4 additions and 2 deletions

View File

@ -112,10 +112,10 @@ try:
if state == green_light:
continue
state = green_light
if state == False:
if green_light == False:
continue
state = green_light
counter += 1
# собираем предварительные данные
x = two_byte_convert(client.read_holding_registers(2332, 2, MODBUS_SLAVE_ID))
@ -151,6 +151,8 @@ try:
set_user_register(d, values)
result = client.read_holding_registers(indent + s + k * d, k, MODBUS_SLAVE_ID)
print(s + d, "===", two_byte_convert(result) * 0.001)
client.write_coil(0, !green_light, MODBUS_SLAVE_ID)
except Exception as e: