mpu6886
CircuitPython helper library for the MPU6886 6-DoF Accelerometer and Gyroscope
Author(s): Taiki Komoda
Implementation Notes
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
- class mpu6886.ClockSource
Allowed values for
clock_source.ClockSource.CLKSEL_INTERNAL_8MHzClockSource.CLKSEL_INTERNAL_XClockSource.CLKSEL_INTERNAL_YClockSource.CLKSEL_INTERNAL_ZClockSource.CLKSEL_EXTERNAL_32ClockSource.CLKSEL_EXTERNAL_19ClockSource.CLKSEL_RESERVEDClockSource.CLKSEL_STOP
- class mpu6886.GyroRange
Allowed values for
gyro_range.GyroRange.RANGE_250_DPSGyroRange.RANGE_500_DPSGyroRange.RANGE_1000_DPSGyroRange.RANGE_2000_DPS
- class mpu6886.MPU6886(i2c_bus: I2C, address: int = 104)
Driver for the MPU6886 6-DoF accelerometer and gyroscope.
- Parameters:
Quickstart: Importing and using the device
Here is an example of using the
MPU6886class. First you will need to import the libraries to use the sensorimport board import mpu6886
Once this is done you can define your
board.I2Cobject and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sensor = mpu6886.MPU6886(i2c)
Now you have access to the
acceleration,gyroandtemperatureattributesacc_x, acc_y, acc_z = sensor.acceleration gyro_x, gyro_y, gyro_z = sensor.gyro temperature = sensor.temperature
- property cycle: bool
Enable or disable periodic measurement at a rate set by
cycle_rate(). If the sensor was in sleep mode, it will be waken up to cycle
- sample_rate_divisor = 25
The sample rate divisor. See the datasheet for additional detail
- class mpu6886.Range
Allowed values for
accelerometer_range.Range.RANGE_2_GRange.RANGE_4_GRange.RANGE_8_GRange.RANGE_16_G
- class mpu6886.Rate
Allowed values for
cycle_rate.Rate.CYCLE_1_25_HZRate.CYCLE_5_HZRate.CYCLE_20_HZRate.CYCLE_40_HZ