Skip to content

Commit 426157e

Browse files
authored
Pedometer example: specify device carefuly
1 parent e7da74f commit 426157e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/lsm6ds_pedometer.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@
1212
from adafruit_lsm6ds import AccelRange, Rate
1313

1414
# pylint:disable=no-member
15-
from adafruit_lsm6ds.lsm6ds33 import LSM6DS33
15+
# Import the correct class for the sensor that you have.
16+
# Change the import as needed. Not all are listed here.
17+
# Note that the LSM6DS3TRC uses a different I2C register to enable the pedometer,
18+
# so the device classes are not interchangeable.
19+
from adafruit_lsm6ds.lsm6ds3trc import LSM6DS3TRC as LSM
20+
# from adafruit_lsm6ds.lsm6ds33 import LSM6DS33 as LSM
21+
1622

1723
i2c = board.I2C() # uses board.SCL and board.SDA
1824
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
19-
sensor = LSM6DS33(i2c)
25+
sensor = LSM(i2c)
2026

2127
# enable accelerometer sensor @ 2G and 26 Hz
2228
sensor.accelerometer_range = AccelRange.RANGE_2G

0 commit comments

Comments
 (0)