I'd like it to just do this on new lines and not for \n & \r. I've tried every combination of parameters in uart.readline('\n\r'), uart.readline('\n) uart.readline('\r')... passing parameters seems to have no effect what so ever. I can't find any documentation on this?
I'm new to programming in Python & programming full stop Any pointers will be appreciated.
b'$$810818076011147\n'
b'\r'
b'$$8203178256\n'
b'\r'
b'$$83042150000\n'
b'\r'
b'$$84042160000\n'
b'\r'
b'$$8506059000000\n'
b'\r'
b'$$86042312560\n'
b'\r'
b'$$87042280531\n'
b'\r$$8803016RUN\n'
b'\r'
Code: Select all
from machine import UART # load resources
uart = UART(2, 19200, bits=8, parity=0, stop=1, rx=16, tx=17, timeout=0) # create UART object
while True: # loop continuously
if uart.any(): # has there gone a minute/is there new data?
incoming=uart.readline('\r\n') # read from the UART
print(incoming) # write status