UIFlow Guide
Initialize the RS232 communication module (UART1), and in the loop, check if there is remaining buffered data. If there is, read and display all byte data, while also generating a random integer.
from m5stack import *
from m5ui import *
from uiflow import *
import module
setScreenColor(0x00006d)
rand = None
rs232 = module.get(module.RS232)
import random
rs232_1 = rs232.init(1, tx=17, rx=16, baudrate=9600, data_bits=8, stop_bits=1, parity=None)
while True:
if rs232_1.any():
print((str('show all bytes:') + str((rs232_1.read()))))
rand = random.randint(100000, 999999)
wait_ms(2)
any()
rs232.init(1, tx=17, rx=16, baudrate=9600, data_bits=8, stop_bits=1, parity=None)
read()
readline()
read(10)
write(''+"\r\n")
write(''+"\r\n")
write(bytes([0, 0, 0]))