pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit Gesture

Example

Unit Gesture reads the gesture

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

setScreenColor(0x222222)
gesture_0 = unit.get(unit.GESTURE, unit.PORTA)

gesture_0.begin()
gesture_0.set_gesture_highrate(True)
while True:
  print(gesture_0.get_gesture())
  print(gesture_0.gesture_description((gesture_0.get_gesture())))
  if gesture_0.GestureUp:
    print('up')
  wait(1)
  wait_ms(2)

API

gesture_0.begin()
  • Initialize Unit
print(gesture_0.get_gesture())
  • Get gesture
print(gesture_0.gesture_description((gesture_0.get_gesture())))
  • Get the description (get the value of the gesture), used with the obtained gesture value
gesture_0.set_gesture_highrate(True)
  • Set high speed (true or false)
print(gesture_0.GestureNone)
  • Gesture value Returns the value of the potential. It is mainly used for logical operations.
  • If set to UP, Unit retrieves the gesture made by the user as up and returns true
On This Page