pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit Accel

案例程序

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

setScreenColor(0x222222)
accel_0 = unit.get(unit.ACCEL, unit.PORTA)

while True:
  print((str('X ACC:') + str((accel_0.acceleration[0]))))
  print((str('Y ACC:') + str((accel_0.acceleration[1]))))
  print((str('Z ACC:') + str((accel_0.acceleration[2]))))
  wait_ms(2)

功能说明

print((str('X ACC:') + str((accel_0.acceleration[0]))))
  • 获取 X 加速值
print((str('Y ACC:') + str((accel_0.acceleration[1]))))
  • 获取 Y 加速值
print((str('Z ACC:') + str((accel_0.acceleration[2]))))
  • 获取 Z 加速值
On This Page