Add color while playing
use defined colors to color NeoPixels while sound is playing per Limor
This commit is contained in:
parent
6095703c51
commit
681fc94b03
1 changed files with 6 additions and 4 deletions
|
|
@ -23,15 +23,17 @@ audio_file = ["01.wav", "02.wav", "03.wav",
|
||||||
"04.wav", "05.wav", "06.wav",
|
"04.wav", "05.wav", "06.wav",
|
||||||
"07.wav"]
|
"07.wav"]
|
||||||
|
|
||||||
# step colors
|
# NeoPixel colors
|
||||||
step_col = [WHITE, RED, YELLOW, GREEN, AQUA, BLUE, PURPLE, BLACK]
|
step_col = [RED, YELLOW, GREEN, AQUA, BLUE, PURPLE, WHITE]
|
||||||
|
|
||||||
def play_it(index):
|
def play_it(index):
|
||||||
cpx.play_file(audio_file[index])
|
cpx.pixels.fill(step_col[index]) # Light lights
|
||||||
|
cpx.play_file(audio_file[index]) # play clip
|
||||||
print("playing file " + audio_file[index])
|
print("playing file " + audio_file[index])
|
||||||
|
cpx.pixels.fill(BLACK) # unlight lights
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
# playback mode
|
# playback mode
|
||||||
|
|
||||||
if cpx.touch_A1:
|
if cpx.touch_A1:
|
||||||
play_it(0)
|
play_it(0)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue