Adding a physical switch interface to the Internet radio

Now that you have had the opportunity to experiment with sensing switches, we need to develop the code to add the external buttons to the Internet radio.

We will use four buttons, which are as follows:

  • Two buttons for scrolling forward and backwards through the playlist using the Spinbox actions
  • A button to select or start the playlist entry
  • A button to stop the radio
  • An LED to indicate each switch entry
  • The mouse interface will still work

The code for adding a switch interface is encapsulated enough to provide a small demo of the buttons in action using IDLE3 before we combine the code.

The complete demo code is shown after the following paragraph. You have the option to type it in and then save ...

Get Raspberry Pi Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.