2 import RPi
.GPIO
as gpio
5 pins
= [25, 24, 18, 22]
7 guitars
= ['sounds/guitar1.wav',
15 for pin
, wav
in zip(pins
, guitars
):
16 sounds
[pin
] = pygame
.mixer
.Sound(wav
)
18 def handle_sound(pin
):
19 if not gpio
.input(pin
):
25 gpio
.setup(pin
, gpio
.IN
)
26 gpio
.add_event_detect(pin
, gpio
.BOTH
, callback
=handle_sound
, bouncetime
=200)