/CircuitPython_MPU6886

CircuitPython helper library for the MPU6886 6-DoF Accelerometer and Gyroscope

Primary LanguagePythonMIT LicenseMIT

Introduction

CircuitPython helper library for the MPU6886 6-DoF Accelerometer and Gyroscope

Discord Build Status Code Style: Black

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Installing from PyPI

Note

This library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install mpu6886

Or the following command to update an existing version:

circup update

Usage Example

import time
import board
import mpu6886

i2c = board.I2C()  # uses board.SCL and board.SDA
mpu = mpu6886.MPU6886(i2c)

while True:
    ac = mpu.acceleration
    gy = mpu.gyro
    print(f"Acceleration: X:{ac[0]:.2f}, Y:{ac[1]:.2f}, Z:{ac[2]:.2f} m/s^2")
    print(f"Gyro X:{gy[0]:.2f}, Y:{gy[1]:.2f}, Z:{gy[2]:.2f} rad/s")
    print(f"Temperature: {mpu.temperature:.2f} C")
    print("")
    time.sleep(1)

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.