CircuitPython helper library for the QMI8658C 6-DoF Accelerometer and Gyroscope
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.
Note
This library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!
Make sure that you have circup installed in your Python environment.
Install it with the following command if necessary:
pip3 install circupWith circup installed and your CircuitPython device connected use the
following command to install:
circup install qmi8658cOr the following command to update an existing version:
circup updateimport time
import board
import qmi8658c
i2c = board.I2C() # uses board.SCL and board.SDA
# If board.I2C is not defined, select the actual I²C pins. eg: SDA=GP6, SCL=GP7
# import busio
# i2c = busio.I2C(board.GP7, board.GP6)
sensor = 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)Accelerometer low power(LP) mode must be a gyro disabled.
sensor.gyro_enable = 0
sensor.accelerometer_rate = AccRate.RATE_LP_21_HZAPI documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.