UIFlow Guide
输出按钮状态
from m5stack import *
from m5ui import *
from uiflow import *
import unit
setScreenColor(0x222222)
dual_button_0 = unit.get(unit.DUAL_BUTTON, unit.PORTB)
while True:
if dual_button_0.btnBlue.wasPressed():
rgb.setColorAll(0x000099)
print('Blue button pressed')
elif dual_button_0.btnRed.wasPressed():
rgb.setColorAll(0xcc0000)
print('Red button pressed')
wait_ms(2)
def btnRed0_wasPressed():
# global params
pass
dual_button_0.btnRed.wasPressed(btnRed0_wasPressed)
print((str('status:') + str((dual_button_0.btnRed.wasPressed()))))