I am reading from two serial ports and combine the two data streams into a third, so I want to read the two uarts on the Pico. The problem is that as long as the uarts is receiving data continuously everything works fine. But when one of the sources stops feeding data the Pico is waiting to get data. It will simply not continue exacting the next line of code.
Executing the (almost) same code on my PyBoard it works flawlessly. Any suggestions?
Code: Select all
from machine import UART import time u0 = UART(0, baudrate=38400) #Pi Pico #u0 = UART(2, 38400) #PyBoard 1.1 #u0.init(38400, bits=8, parity=None, stop=1, rxbuf=512) #PyBoard 1.1 u1 = UART(1, baudrate=38400) #Pi Pico #u1 = UART(4, 38400) #PyBoard 1.1 #u1.init(38400, bits=8, parity=None, stop=1, rxbuf=512) #PyBoard 1.1 while True: if u0.any() > 0: x = u0.readline() print(x) if u1.any() > 0: y = u1.readline() print(y)