Raspberry Pi pico will not receive complete data if uart.readline() is used to read serial data

Thread Starter

Young2

Joined Dec 7, 2020
93
Raspberry Pi pico will not receive complete data if uart.readline() is used to read serial data.
I use THONNY, how do I solve this problem?
 

ericgibbs

Joined Jan 29, 2010
15,735
hi Y2,
Have you tried
E

uart.read(10) # read 10 characters, returns a bytes object
uart.read() # read all available characters
uart.readline() # read a line
uart.readinto(buf) # read and store into the given buffer
uart.write('abc') # write the 3 characters
 

Thread Starter

Young2

Joined Dec 7, 2020
93
You are right, I tried to use the uart.read() function.
I found that the underlying logic of the uart.readline() function is to determine the carriage return character, so when used in conjunction with the serial screen command the last bit of my command is not a carriage return character, so I cannot receive the data in its entirety. I can use uart.read() and then specify the number of characters.
 
Top