UIFlow Guide
获取陀螺仪当前状态
from m5stack import *
from m5ui import *
from uiflow import *
import unit
setScreenColor(0x222222)
unit_imu_0 = unit.get(unit.IMU6886, unit.PORTA)
unit_imu_0.setAccUnit(0)
unit_imu_0.gyroFullScaleRange(0x00)
while True:
print((str('ACC Z:') + str((unit_imu_0.acceleration[0]))))
print((str('ACC Y:') + str((unit_imu_0.acceleration[1]))))
print((str('ACC Y:') + str((unit_imu_0.acceleration[2]))))
print((str('Gyro X:') + str((unit_imu_0.gyro[0]))))
print((str('Gyro Y:') + str((unit_imu_0.gyro[1]))))
print((str('Gyro Z:') + str((unit_imu_0.gyro[2]))))
wait_ms(2)
unit_imu_0.accFullScaleRange(0x00)
print(unit_imu_0.acceleration[0])
print(unit_imu_0.acceleration[1])
print(unit_imu_0.acceleration[2])
print(unit_imu_0.gyro[0])
print(unit_imu_0.gyro[1])
print(unit_imu_0.gyro[2])
print(unit_imu_0.ypr[1])
print(unit_imu_0.ypr[2])
unit_imu_0.gyroCalibrate(250, 5)
unit_imu_0.gyroFullScaleRange(0x00)
unit_imu_0.setAccUnit(0)
unit_imu_0.setGyroOffsets(0, 0, 0)