Commit 8bd9a388 authored by Ivan Tyagov's avatar Ivan Tyagov

control relay2 over modbus.

parent c8cf66fa
......@@ -69,14 +69,24 @@ class LimeModbusSlaveContext(ModbusSlaveContext):
value = int(values[0])
log.debug(address)
log.debug(value)
if int(address) == 0 :
# relay 1
if int(address) == 0:
if value == 1:
sendI2Ccommand(0x01)
elif value == 0:
sendI2Ccommand(0x00)
# relay 2
if int(address) == 1:
# relay1
if value == 1:
# on
sendI2Ccommand(0x01)
sendI2Ccommand(0x03)
elif value == 0:
sendI2Ccommand(0x00)
def run_async_server():
store = LimeModbusSlaveContext(
di=ModbusSequentialDataBlock(0, [0]*10),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment