diff --git a/client.py b/client.py index 1bebfdf..5ed1847 100644 --- a/client.py +++ b/client.py @@ -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: