added SENSITIVITY variabe, only check Z accel axis
This commit is contained in:
parent
8fde8fb0f6
commit
44f19e582c
1 changed files with 3 additions and 2 deletions
|
|
@ -16,6 +16,7 @@ splash = displayio.Group()
|
|||
board.DISPLAY.show(splash)
|
||||
|
||||
max_brightness = 2 ** 15
|
||||
SENSITIVITY = 5 # reading in Z direction to trigger, adjustable
|
||||
|
||||
images = list(filter(lambda x: x.endswith("bmp"), os.listdir("/")))
|
||||
|
||||
|
|
@ -52,11 +53,11 @@ while True:
|
|||
# Wait forever
|
||||
while not shaken:
|
||||
try:
|
||||
ACCEL_X, ACCEL_Y, ACCEL_Z = ACCEL.acceleration # Read the accelerometer
|
||||
ACCEL_Z = ACCEL.acceleration[2] # Read Z axis acceleration
|
||||
except IOError:
|
||||
pass
|
||||
# print(ACCEL_Z) # uncomment to see the accelerometer z reading
|
||||
if ACCEL_Z > 5:
|
||||
if ACCEL_Z > SENSITIVITY:
|
||||
shaken = True
|
||||
|
||||
# Fade down the backlight
|
||||
|
|
|
|||
Loading…
Reference in a new issue