pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit LCD

案例程序

输出按钮状态

from m5stack import *
from m5ui import *
from uiflow import *
import unit

setScreenColor(0x222222)
limit_0 = unit.get(unit.LIMIT, unit.PORTB)
dual_button_0 = unit.get(unit.DUAL_BUTTON, unit.PORTB)

while True:
  if limit_0.get_switch_status():
    print('Blue button pressed')
  else:
    print('Red button pressed')
  wait_ms(2)

功能说明

print((str('status:') + str((limit_0.get_switch_status()))))
  • 获取当前按钮状态
On This Page