mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Update modbus_rtu_slave.py
This commit is contained in:
parent
f38dcc3505
commit
c5cdf92ad1
@ -1,12 +1,17 @@
|
||||
import time
|
||||
from pyb import UART
|
||||
from modbus import ModbusRTU
|
||||
uart = UART(3)
|
||||
modbus = ModbusRTU(uart)
|
||||
uart = UART(3,115200, parity=None, stop=2, timeout=1, timeout_char=4)
|
||||
modbus = ModbusRTU(uart, register_num=9999)
|
||||
|
||||
while(True):
|
||||
if modbus.any():
|
||||
modbus.handle()
|
||||
modbus.handle(debug=True)
|
||||
else:
|
||||
time.sleep(100)
|
||||
modbus.REGISTER[0] = 1000
|
||||
modbus.REGISTER[1] += 1
|
||||
modbus.REGISTER[3] += 3
|
||||
#print(modbus.REGISTER[10:15])
|
||||
# image processing in there
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user