IMU

IMU is used to control the built-in accelerometer and gyroscope inside the host device. Below is the detailed IMU support for the host:

MPU6886

BMI270

BMM150

AtomS3

AtomS3 Lite

AtomS3U

StampS3

CoreS3

Core2

TOUGH

StickC Plus

StickC Plus2

Micropython Example:

pass

UIFLOW2 Example:

pass

class IMU

Important

Methods of the IMU Class heavily rely on M5.begin() M5.begin.svg and M5.update() M5.update.svg.

All calls to methods of IMU objects should be placed after M5.begin() M5.begin.svg, and M5.update() M5.update.svg should be called in the main loop.

Methods

IMU.getAccel() tuple[float, float, float]

Get the tuple of x, y, and z values of the accelerometer.

UIFLOW2:

getAccel.svg

IMU.getGyro() tuple[float, float, float]

Get the tuple of x, y, and z values of the gyroscope.

UIFLOW2:

getGyro.svg

IMU.isEnabled() bool

Get whether the IMU object is enabled.

UIFLOW2:

None

IMU.getType() int

Get the chip model of the IMU.

UIFLOW2:

None

class IMU_TYPE

Constants

IMU_TYPE.NULL: int
IMU_TYPE.UNKNOWN: int
IMU_TYPE.SH200Q: int
IMU_TYPE.MPU6050: int
IMU_TYPE.MPU6886: int
IMU_TYPE.MPU9250: int
IMU_TYPE.BMI270: int

The model of the IMU.