Skip to content

Commit 681fc94

Browse files
authored
Add color while playing
use defined colors to color NeoPixels while sound is playing per Limor
1 parent 6095703 commit 681fc94

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Interactive_Map_with_CPX/code.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@
2323
"04.wav", "05.wav", "06.wav",
2424
"07.wav"]
2525

26-
# step colors
27-
step_col = [WHITE, RED, YELLOW, GREEN, AQUA, BLUE, PURPLE, BLACK]
26+
# NeoPixel colors
27+
step_col = [RED, YELLOW, GREEN, AQUA, BLUE, PURPLE, WHITE]
2828

2929
def play_it(index):
30-
cpx.play_file(audio_file[index])
30+
cpx.pixels.fill(step_col[index]) # Light lights
31+
cpx.play_file(audio_file[index]) # play clip
3132
print("playing file " + audio_file[index])
33+
cpx.pixels.fill(BLACK) # unlight lights
3234

3335
while True:
34-
# playback mode
36+
# playback mode
3537

3638
if cpx.touch_A1:
3739
play_it(0)

0 commit comments

Comments
 (0)