UIFlow Guide
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit
setScreenColor(0x5c0000)
can_0 = unit.get(unit.CAN, unit.PORTC)
def buttonB_wasPressed():
# global params
can_0.send([10, 20, 30], 0X710)
pass
btnB.wasPressed(buttonB_wasPressed)
can_0.can_init(0, extframe=True, mode=can_0.NORMAL, baudrate=can_0.BAUDRATE_250K, tx_io=17, rx_io=16, auto_restart=False)
label3.setText(str(can_0.state()))
while True:
if can_0.any():
print((str('message:') + str(can_0.recv())))
print((str('ID:') + str(can_0.remote_id())))
wait_ms(25)
wait_ms(2)
can_0.deinit()
can_0.can_init(0, extframe=True, mode=can_0.NORMAL, baudrate=can_0.BAUDRATE_250K, tx_io=17, rx_io=16, auto_restart=False)
print(can_0.any())
can_0.clear_filter()
can_0.clear_rx_queue()
can_0.clear_tx_queue()
print(can_0.remote_id())
print(can_0.recv())
can_0.restart()
can_0.send('uiflow2', 0)
can_0.set_filter(0, can_0.FILTER_RAW_SINGLE, 'uiflow2')
print(can_0.state())