UIFlow Guide
设置灯的颜色为红色,串口实时打印电位器的X,Y的数值和旋转的角度和按键的状态值
from m5stack import *
from m5ui import *
from uiflow import *
import hat
setScreenColor(0x111111)
hat_joyc_0 = hat.get(hat.JOYC)
hat_joyc_0.SetLedColor(0xff0000)
while True:
print(hat_joyc_0.GetX(0))
print(hat_joyc_0.GetY(0))
print(hat_joyc_0.GetAngle(0))
print(hat_joyc_0.GetPress(0))
wait_ms(2)
hat_joyc_0.GetAngle(0)
hat_joyc_0.GetDistance(0)
hat_joyc_0.GetPress(0)
hat_joyc_0.GetX(0)
hat_joyc_0.GetY(0)
hat_joyc_0.SetLedColor(0x0)