''' Simple program sending an incrementing number over two UART channels to a TTL UART to RS485 converter. Inspired by and partly based on Waveshare's example code to the 2 Channel RS485 HAT for the Pi Pico. Copyright (C) 2024 Benjamin Burkhardt This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ''' from machine import UART, Pin import time uart0 = UART(0, baudrate=115200, tx=Pin(0), rx=Pin(1)) uart1 = UART(1, baudrate=115200, tx=Pin(4), rx=Pin(5)) print('Starting RS485 simple send...') txData = b'Starting RS485 simple send...\r\n' uart0.write(txData) uart1.write(txData) a=0 time.sleep(0.1) while True: time.sleep(0.5) a=a+1 uart0.write("{}\r\n".format(a)) print(f"[CH0]: Sent data: {a}")#shell output time.sleep(0.5) a=a+1 uart1.write("{}\r\n".format(a)) print(f"[CH1]: Sent data: {a}")#shell output