File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 7
7
# Set the tap type: 1=single, 2=double
8
8
cpx .detect_taps = 1
9
9
10
- # NeoPixel settings
10
+ # NeoPixel colors used
11
11
RED = (90 , 0 , 0 )
12
12
BLACK = (0 , 0 , 0 )
13
- step_col = [RED ]
14
13
15
14
cpx .pixels .brightness = 0.1 # set brightness value
16
15
17
16
# The audio file assigned to the touchpad
18
- audio_file = [ "imperial_march.wav" ]
17
+ audio_file = "imperial_march.wav"
19
18
20
- def play_it (index ):
21
- cpx .pixels .fill (step_col [ index ] ) # Light neopixels
22
- cpx .play_file (audio_file [ index ] ) # play audio clip
23
- print ("playing file " + audio_file [ index ] )
19
+ def play_it ():
20
+ cpx .pixels .fill (RED ) # Light neopixels
21
+ cpx .play_file (audio_file ) # play audio clip
22
+ print ("playing file " , audio_file )
24
23
cpx .pixels .fill (BLACK ) # unlight lights
25
24
26
25
while True :
27
26
# playback mode. Use the slide switch to change between
28
27
# trigger via touch or via single tap
29
28
if cpx .switch :
30
29
if cpx .touch_A1 :
31
- play_it (0 )
30
+ play_it ()
32
31
else :
33
32
if cpx .tapped :
34
- play_it (0 )
33
+ play_it ()
You can’t perform that action at this time.
0 commit comments