Explication de la routine 32-Modbus -> modbus_rtu_slave.py Modbus_rtu esclave

Tutoriel vidéo 30 - Utiliser la carte d'extension RS485 pour mettre en œuvre la communication OPENMV et PLC : https://singtown.com/learn/50806/

import time
from pyb import UART
from modbus import ModbusRTU
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(debug=True)
    else:
        time.sleep_ms(100)
        modbus.REGISTER[0] = 1000
        modbus.REGISTER[1] += 1
        modbus.REGISTER[3] += 3
        #print(modbus.REGISTER[10:15])
        # image processing in there

results matching ""

    No results matching ""