67
67
mpr121 = adafruit_mpr121 .MPR121 (i2c )
68
68
69
69
# Demo MODE LED Animations ------------------------------------------------------
70
- rainbow = Rainbow (pixels , speed = 0.1 , period = 10 , name = "rainbow" , step = 1 )
70
+ rainbow = Rainbow (pixels , speed = 0 , period = 10 , name = "rainbow" , step = 1 )
71
71
rainbow_chase = RainbowChase (pixels , speed = 0 , size = 5 , spacing = 10 )
72
72
chase = Chase (pixels , speed = 0.1 , color = RED , size = 1 , spacing = 6 )
73
73
rainbow_comet = RainbowComet (pixels , speed = 0.01 , tail_length = 60 , bounce = True )
@@ -146,7 +146,7 @@ def play_bottle(bottle_id, is_octave):
146
146
light_up (bottle_id )
147
147
if is_octave :
148
148
audio .play (tracks [bottle_id + 7 ]) # Start playing sound
149
- light_up (9 )
149
+ light_up (8 )
150
150
else :
151
151
audio .play (tracks [bottle_id ]) # Start playing sound
152
152
pixels .show ()
@@ -157,6 +157,7 @@ def check_buttons(touched):
157
157
''' check to see if buttons have been pressed'''
158
158
global MODE , LAST_BUTTON
159
159
octave = touched [11 ]
160
+ off = touched [9 ]
160
161
if octave :
161
162
light_up (8 )
162
163
for pad in range (1 , 9 ):
@@ -165,7 +166,7 @@ def check_buttons(touched):
165
166
if pad != LAST_BUTTON and touched [pad ]:
166
167
LAST_BUTTON = pad
167
168
play_bottle (pad - 1 , octave )
168
- if touched [ 9 ] :
169
+ if off :
169
170
MODE = 9
170
171
go_dark ()
171
172
if touched [10 ]:
@@ -180,7 +181,7 @@ def check_buttons(touched):
180
181
while True :
181
182
# Idle mode: Play a Rainbow animation when nothing's being touched
182
183
if MODE == 0 :
183
- pixels .brightness = 1 #rainbow mode is much brighter than the other modes, so adjust here
184
+ pixels .brightness = 0.3 #rainbow mode is much brighter than the other modes, so adjust here
184
185
rainbow .animate ()
185
186
for button in buttons :
186
187
button .update ()
@@ -210,8 +211,8 @@ def check_buttons(touched):
210
211
else :
211
212
MODE = 0 # Return to idle mode
212
213
if MODE == 9 : # MODE 9 is "off" mode, listening for a new button press to wake up.
213
- for button in buttons :
214
- button .update ()
214
+ # for button in buttons:
215
+ # button.update()
215
216
for i in range (12 ):
216
217
if buttons [i ].fell :
217
- MODE = 1
218
+ MODE = 1
0 commit comments