Skip to content

Commit ccfea10

Browse files
authored
Merge pull request #49 from myllyja/add-lsm6ds3
Add LSM6DS3 subclass
2 parents 0f056aa + e82f1c7 commit ccfea10

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

adafruit_lsm6ds/lsm6ds3.py

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2020 Bryan Siepert for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
"""
5+
This module provides the `adafruit_lsm6ds.lsm6ds3` subclass of LSM6DS sensors
6+
===============================================================================
7+
"""
8+
from . import LSM6DS
9+
10+
11+
class LSM6DS3(LSM6DS): # pylint: disable=too-many-instance-attributes
12+
13+
"""Driver for the LSM6DS3 6-axis accelerometer and gyroscope.
14+
15+
:param ~busio.I2C i2c_bus: The I2C bus the LSM6DS3 is connected to.
16+
:param int address: The I2C device address. Defaults to :const:`0x6A`
17+
18+
19+
**Quickstart: Importing and using the device**
20+
21+
Here is an example of using the :class:`LSM6DS3` class.
22+
First you will need to import the libraries to use the sensor
23+
24+
.. code-block:: python
25+
26+
import board
27+
from adafruit_lsm6ds.lsm6ds3 import LSM6DS3
28+
29+
Once this is done you can define your `board.I2C` object and define your sensor object
30+
31+
.. code-block:: python
32+
33+
i2c = board.I2C() # uses board.SCL and board.SDA
34+
sensor = LSM6DS3(i2c)
35+
36+
Now you have access to the :attr:`acceleration` and :attr:`gyro`: attributes
37+
38+
.. code-block:: python
39+
40+
acc_x, acc_y, acc_z = sensor.acceleration
41+
gyro_x, gyro_y, gyro_z = sensor.gyro
42+
43+
"""
44+
45+
CHIP_ID = 0x6A

0 commit comments

Comments
 (0)