-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Raspberry Pi Essentials
By :

Since the action code for Python is so similar to that for TKinter, we will go directly to a TKinter interface for switch sensing. Since the plan is to eventually create push buttons for our Internet radio, let's show the breadboard schematic that we need to achieve this:
Warning: While the schematic shown is quite OK for breadboard use, it is not suitable where the wires to the switches are long (greater than a few inches). Notice that the GPIO pin would be exposed directly to any fault conditions. It is advisable to put at least a 1k Ohm series resistor to the GPIO pin. Never run the 5 Volt or 3.3 Volt supply through a long line to the switch (or LED location) as this directly exposes the supply to any potential wiring faults.
In preparation for the demo, complete the following:
Download the tkswitch21.py
code from http://1drv.ms/1ysAxkl.
Store the tkswitch21.py
file in /home/pi/gpio
.
Run the code using IDLE3 by starting from a command line with sudo idle3
(remember...
Change the font size
Change margin width
Change background colour