Skip to content

attempt new accelerometer init if first one fails #70

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
Apr 1, 2025
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
6 changes: 5 additions & 1 deletion adafruit_pybadger/clue.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import audiopwmio
import keypad
import adafruit_lsm6ds.lsm6ds33
import adafruit_lsm6ds.lsm6ds3trc
import neopixel
from adafruit_pybadger.pybadger_base import PyBadgerBase, KeyStates

Expand All @@ -51,7 +52,10 @@ def __init__(self) -> None:
i2c = board.I2C()

if i2c is not None:
self._accelerometer = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c)
try:
self._accelerometer = adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c)
except RuntimeError:
self._accelerometer = adafruit_lsm6ds.lsm6ds3trc.LSM6DS3TRC(i2c)

# NeoPixels
self._neopixels = neopixel.NeoPixel(
Expand Down