Reader small image

You're reading from  Raspberry Pi Essentials

Product typeBook
Published inApr 2015
Publisher
ISBN-139781784396398
Edition1st Edition
Right arrow
Author (1)
Jack Creasey
Jack Creasey
author image
Jack Creasey

Jack Creasey has been in the technology industry for more than 30 years, the last 15 years as a Senior Program Manager in hardware and software design. His expertise includes designing, developing, and teaching IT courseware. He is an avid inventor and holds 13 patents in hardware and software design. After retiring early from the computing industry, Jack avidly participates in social network groups that share his passion for next generation technology solutions.
Read more about Jack Creasey

Right arrow

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 it in a file you created, called /home/pi/gpio/tkswitches.py. Or you can download the tkswitches.py code from http://1drv.ms/1ysAxkl.

The code opens an empty TKinter window when started and allows you to test all four buttons and the LED. The only...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Raspberry Pi Essentials
Published in: Apr 2015Publisher: ISBN-13: 9781784396398

Author (1)

author image
Jack Creasey

Jack Creasey has been in the technology industry for more than 30 years, the last 15 years as a Senior Program Manager in hardware and software design. His expertise includes designing, developing, and teaching IT courseware. He is an avid inventor and holds 13 patents in hardware and software design. After retiring early from the computing industry, Jack avidly participates in social network groups that share his passion for next generation technology solutions.
Read more about Jack Creasey