6767mpr121 = adafruit_mpr121 .MPR121 (i2c )
6868
6969# 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 )
7171rainbow_chase = RainbowChase (pixels , speed = 0 , size = 5 , spacing = 10 )
7272chase = Chase (pixels , speed = 0.1 , color = RED , size = 1 , spacing = 6 )
7373rainbow_comet = RainbowComet (pixels , speed = 0.01 , tail_length = 60 , bounce = True )
@@ -146,7 +146,7 @@ def play_bottle(bottle_id, is_octave):
146146 light_up (bottle_id )
147147 if is_octave :
148148 audio .play (tracks [bottle_id + 7 ]) # Start playing sound
149- light_up (9 )
149+ light_up (8 )
150150 else :
151151 audio .play (tracks [bottle_id ]) # Start playing sound
152152 pixels .show ()
@@ -157,6 +157,7 @@ def check_buttons(touched):
157157 ''' check to see if buttons have been pressed'''
158158 global MODE , LAST_BUTTON
159159 octave = touched [11 ]
160+ off = touched [9 ]
160161 if octave :
161162 light_up (8 )
162163 for pad in range (1 , 9 ):
@@ -165,7 +166,7 @@ def check_buttons(touched):
165166 if pad != LAST_BUTTON and touched [pad ]:
166167 LAST_BUTTON = pad
167168 play_bottle (pad - 1 , octave )
168- if touched [ 9 ] :
169+ if off :
169170 MODE = 9
170171 go_dark ()
171172 if touched [10 ]:
@@ -180,7 +181,7 @@ def check_buttons(touched):
180181while True :
181182 # Idle mode: Play a Rainbow animation when nothing's being touched
182183 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
184185 rainbow .animate ()
185186 for button in buttons :
186187 button .update ()
@@ -210,8 +211,8 @@ def check_buttons(touched):
210211 else :
211212 MODE = 0 # Return to idle mode
212213 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()
215216 for i in range (12 ):
216217 if buttons [i ].fell :
217- MODE = 1
218+ MODE = 1
0 commit comments