
UIFlow Guide
Sets the LED color to red and continuously prints the joystick’s X and Y potentiometer values, rotation angle, and button press state in the serial output.
 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)