write coil
This commit is contained in:
parent
0136e173a1
commit
71e87c7034
|
@ -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))
|
||||
|
@ -152,6 +152,8 @@ try:
|
|||
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:
|
||||
print("error", e)
|
||||
|
|
Loading…
Reference in New Issue