pdf-icon

UIFlow 上手教程

UiFlow1 Blockly

Event

Unit

UiFlow1 项目配置

Unit Key

案例程序

按下按钮,测试按键

from m5stack import *
from m5stack_ui import *
from uiflow import *
import unit

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)
key_0 = unit.get(unit.KEY, unit.PORTB)

key_0.set_color(0xff0000, 50)
while True:
  if key_0.get_switch_status():
    print((str('status:') + str((key_0.get_switch_status()))))
  wait_ms(2)

功能说明

print((str('status:') + str((key_0.get_switch_status()))))
  • 获取按键开关状态
key_0.set_color(0xff0000, 50)
  • 设置按键颜色
key_0.set_color(0xff0000, 50)
  • 设置按键颜色
  • Palette
  • RGB
  • HEX
key_0.set_color(0x000000, 50)
  • 设置按键RGB颜色
On This Page