Skip to content

Commit ec8fdd1

Browse files
authored
Merge pull request #3109 from adafruit/TheKitty-patch-12
Update code.py
2 parents 77bd7db + fac7d81 commit ec8fdd1

File tree

1 file changed

+7
-3
lines changed
  • CircuitPython_LED_Sand_Hourglass/hourglass

1 file changed

+7
-3
lines changed

CircuitPython_LED_Sand_Hourglass/hourglass/code.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import time
66
import board
7-
import adafruit_lsm6ds.lsm6ds33
87
from adafruit_ht16k33 import matrix
98
import matrixsand
109

@@ -14,8 +13,13 @@
1413
i2c = board.I2C() # uses board.SCL and board.SDA
1514
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
1615

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

2024
# the matrices
2125
m1 = matrix.Matrix8x8(i2c, 0x70)

0 commit comments

Comments
 (0)