Skip to content

Commit 708341d

Browse files
authored
Update code.py
Use code from https://learn.adafruit.com/adafruit-feather-sense/circuitpython-sense-demo to check between the two IMUs that may be on the Adafruit Feather Sense
1 parent 015b1f3 commit 708341d

File tree

1 file changed

+7
-2
lines changed
  • CircuitPython_LED_Sand_Hourglass/single_matrix

1 file changed

+7
-2
lines changed

CircuitPython_LED_Sand_Hourglass/single_matrix/code.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@
1414
i2c = board.I2C() # uses board.SCL and board.SDA
1515
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
1616

17-
# the accelo
18-
accelo = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c)
17+
# check for LSM6DS33 or LSM6DS3TR-C (Adafruit Feather Sense)
18+
try:
19+
from adafruit_lsm6ds.lsm6ds33 import LSM6DS33 as LSM6DS
20+
lsm6ds = LSM6DS(i2c)
21+
except RuntimeError:
22+
from adafruit_lsm6ds.lsm6ds3 import LSM6DS3 as LSM6DS
23+
lsm6ds = LSM6DS(i2c)
1924

2025
# the matrix
2126
matrix = matrix.Matrix8x8(i2c, 0x70)

0 commit comments

Comments
 (0)