/CircuitPython_QMI8658C

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

Primary LanguagePythonMIT LicenseMIT

Introduction

CircuitPython helper library for the QMI8658C 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 qmi8658c

Or the following command to update an existing version:

circup update

Usage Example

import time
import board
import qmi8658c

i2c = board.I2C()  # uses board.SCL and board.SDA
mpu = qmi8658c.QMI8658C(i2c)

while True:
    ac = sensor.acceleration
    gy = sensor.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: {sensor.temperature:.2f} C")
    print("")
    time.sleep(1)

Usage Note

Accelerometer low power(LP) mode must be a gyro disabled.

sensor.gyro_enable = 0
sensor.accelerometer_rate = AccRate.RATE_LP_21_HZ

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.