
Now that you have the circuit breadboarded, it’s time to work
on the code:
1. Create a new directory in your home directory called
sound-
board
.
2. Open that folder and create a file there called
soundboard.py
.
3. Open
soundboard.py
and type in the following code:
import pygame.mixer
from time import sleep
from gpiozero import Button
from sys import exit
button1 = Button(4)
button2 = Button(14)
button3 = Button(25) Again, BCM 4,14 and 25 match up
with pins 4,14, and 25??
pygame.mixer.init(48000, -16, 1, 1024)
soundA = pygame.mixer.Sound(
"/usr/share/sounds/alsa/Front_Center.wav")
soundB = pygame.mixer.Sound(
"/usr/share/sounds/alsa/Front_Left.wav")
soundC ...