Skip to content

Add LSM6DS3 subclass #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions adafruit_lsm6ds/lsm6ds3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# SPDX-FileCopyrightText: Copyright (c) 2020 Bryan Siepert for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
This module provides the `adafruit_lsm6ds.lsm6ds3` subclass of LSM6DS sensors
===============================================================================
"""
from . import LSM6DS


class LSM6DS3(LSM6DS): # pylint: disable=too-many-instance-attributes

"""Driver for the LSM6DS3 6-axis accelerometer and gyroscope.

:param ~busio.I2C i2c_bus: The I2C bus the LSM6DS3 is connected to.
:param int address: The I2C device address. Defaults to :const:`0x6A`


**Quickstart: Importing and using the device**

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

.. code-block:: python

import board
from adafruit_lsm6ds.lsm6ds3 import LSM6DS3

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

.. code-block:: python

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

Now you have access to the :attr:`acceleration` and :attr:`gyro`: attributes

.. code-block:: python

acc_x, acc_y, acc_z = sensor.acceleration
gyro_x, gyro_y, gyro_z = sensor.gyro

"""

CHIP_ID = 0x6A