English
English
简体中文
日本語

UiFlow Tutorial

UiFlow1 Development Guide

Project Management

Use LTE network

UiFlow1 Blockly

Event

Unit

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
Page Tools
PDF
On This Page