pdf-icon

UIFlow Guide

UiFlow1 Blockly

Event

Unit

UiFlow1 Project

Unit Mini IMU-Pro

Example

Obtain the gyroscope status, including the current atmospheric temperature and pressure

from m5stack import *
from m5stack_ui import *
from uiflow import *
import libs.bmi270 as bmi270
import unit

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)
imu_pro_0 = unit.get(unit.IMU_PRO, unit.PORTA)

imu_pro_0.imu_instance.set_gyr_odr(bmi270.GYR_ODR_200)
while True:
  print((str('temperature:') + str((imu_pro_0.temperature))))
  print((str('pressure:') + str((imu_pro_0.pressure))))
  print((str('acceleratuin:') + str((imu_pro_0.acceleration))))
  print((str('gyro:') + str((imu_pro_0.gyro))))
  wait_ms(2)

API

imu_pro_0.imu_instance.set_acc_odr(bmi270.ACC_ODR_200)
  • Set the output data rate of the accelerometer
imu_pro_0.imu_instance.set_acc_range(bmi270.ACC_RANGE_2G)
  • Set the measurement range of the accelerometer
imu_pro_0.imu_instance.set_gyr_odr(bmi270.GYR_ODR_200)
  • Set the output data rate of the gyroscope
imu_pro_0.imu_instance.set_acc_range(bmi270.GYR_RANGE_250)
  • Set the measurement range of the gyroscope
print((str('acceleration:') + str((imu_pro_0.acceleration))))
  • Get accelerometer data
print((str('attitude angles:') + str((imu_pro_0.attitude))))
  • Get attitude angle data
print((str('compass angle:') + str((imu_pro_0.compass))))
  • Get electronic compass data
print((str('gyro:') + str((imu_pro_0.gyro))))
  • Get gyroscope data
print((str('magnetometer value:') + str((imu_pro_0.magnetometer))))
  • Get magnetometer data
print((str('pressure:') + str((imu_pro_0.pressure))))
  • Get barometer data
print((str('termperature:') + str((imu_pro_0.temperature))))
  • Get temperature data
imu_pro_0.setGyroOffsets(0, 0, 0)
  • Set gyroscope zero bias calibration value
On This Page