Now we are going to build upon what we learned in the previous chapter with regards to GPIO pins. We looked very briefly at how we can take a reading from the GPIO pins using Python. However, since we had no hardware connected to the GPIO pin, we got a reading of 0
.
The following project involves connecting a number of buttons to the GPIO pins so we can use the input value when pressed to switch between MP3 files.
Before building the hardware, there are a number of software libraries we need to install so we can import them into our program.
So let's start by looking at these.
We are going to be installing the audio drivers for ALSA onto Raspbian first.
As discussed in the introduction, ALSA is used to provide an audio interface for Linux to the Raspberry Pi's hardware.
The two libraries we will install are alsa-utils
and mpg123
.
The alsa-utils
library contains a number of utilities that are handy for controlling a sound card via Linux...