adafruit_fxas21002c

CircuitPython module for the NXP FXAS21002C gyroscope. Based on the driver from: https://github.com/adafruit/Adafruit_FXAS21002C

See examples/simpletest.py for a demo of the usage.

  • Author(s): Tony DiCola

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_fxas21002c.FXAS21002C(i2c, address=33, gyro_range=250)[source]

Driver for the NXP FXAS21002C gyroscope.

Parameters:
  • i2c (I2C) – The I2C bus the device is connected to
  • address (int) – The I2C device address. Defaults to 0x21
  • gyro_range (int) – Device range. Defaults to 250.

Quickstart: Importing and using the device

Here is an example of using the FXAS21002C class. First you will need to import the libraries to use the sensor

import board
import adafruit_fxas21002c

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
sensor = adafruit_fxas21002c.FXAS21002C(i2c)

Now you have access to the gyroscope attribute

gyro_x, gyro_y, gyro_z = sensor.gyroscope
gyroscope

Read the gyroscope value and return its X, Y, Z axis values as a 3-tuple in radians/second.

read_raw()[source]

Read the raw gyroscope readings. Returns a 3-tuple of X, Y, Z axis 16-bit signed values. If you want the gyroscope values in friendly units consider using the gyroscope property!