pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit Joystick

Example

Gets the current state of the joystick

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

setScreenColor(0x222222)
joystick_0 = unit.get(unit.JOYSTICK, unit.PORTA)

while True:
  print(joystick_0.X)
  print(joystick_0.Y)
  print(joystick_0.Press)
  wait(0.2)
  wait_ms(2)

API

print(joystick_0.Press)
  • Get is pressed Returns the key value
print(joystick_0.InvertX)
  • Get Reverse X Returns the reverse X-axis data
print(joystick_0.InvertY)
  • Get Reverse Y Returns the reverse data of the Y-axis
print(joystick_0.X)
  • Get X Returns the X-axis data
print(joystick_0.Y)
  • Get Y Returns the data of the Y-axis
On This Page