Hardware Reference
In-Depth Information
Part Three: Controlling the
Jukebox with Buttons
You jukebox will use buttons to control the playback of music on your Raspberry Pi. In
this part of the project, you connect your buttons to your circuit and modify your pro-
gram so that you can use the buttons to play, pause and skip tracks. You will require
four buttons: one to play, one to pause, one to skip tracks backwards and one to skip
tracks forwards. You'll add these buttons to the breadboard next to the LCD screen.
Connecting the Buttons
In the following steps, you add the four buttons to the breadboard and connect them
with wires to the Raspberry Pi GPIO. Refer to the wiring diagram in Figure 9-8 as you
work.
You must turn off the power supply before doing Step 5, so I advise you to go
ahead and do that now.
1. Push the buttons into the breadboard so that the legs bridge the gap along the
center of the board (in the same way as the LED button project in Adventure 8).
2. Take a 10K ohm resistor and push one end into a hole, one down from the left
button leg on the side of the breadboard where the LCD screen is mounted (the
south side). Place the other end of the resistor into a hole in the blue (negative)
power column of the breadboard, again on the south side.
3. Next take a male-to-male jumper cable and place one end into a hole on the
north side of the breadboard, on the same row as the other leg of the button (a
white cable in Figure 9-8), and place the other end into the red (positive) power
column on the north side of the breadboard.
4. Repeat Steps 2 and 3 for the three remaining buttons, using three more resistors
and male-to-male jumper cables.
5. Now you need to connect the buttons to the Raspberry Pi GPIO pins. Make sure
your Raspberry Pi is powered of before you start. You have already used
many of the pins for the LCD screen—but don't worry, you only need four, one
for each button. Take a male-to-female jumper cable, and push the male pin into
the hole that you left between the button leg and the resistor. Push the female
end into GPIO 11 (a green cable in Figure 9-8). his irst button is the play
button.
Search WWH ::




Custom Search