File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,8 @@ def __init__(self, i2c=None):
90
90
self ._accelerometer = adafruit_lis3dh .LIS3DH_I2C (i2c , address = 0x19 , int1 = int1 )
91
91
except ValueError :
92
92
self ._accelerometer = adafruit_lis3dh .LIS3DH_I2C (i2c , int1 = int1 )
93
+ except RuntimeError :
94
+ self ._accelerometer = None
93
95
94
96
# Buttons
95
97
self ._buttons = GamePadShift (digitalio .DigitalInOut (board .BUTTON_CLOCK ),
@@ -202,7 +204,10 @@ def light(self):
202
204
@property
203
205
def acceleration (self ):
204
206
"""Accelerometer data."""
205
- return self ._accelerometer .acceleration
207
+ acceleration = None
208
+ if self ._accelerometer is not None :
209
+ acceleration = self ._accelerometer .acceleration
210
+ return acceleration
206
211
207
212
@property
208
213
def brightness (self ):
You can’t perform that action at this time.
0 commit comments