Hardware Reference
In-Depth Information
FIGURE.5-12
Wiring diagram for the 7-segment display on the Raspberry Pi
FIGURE.5-13
Wiring diagram for the 7-segment display on the Arduino
Writing Python to Drive the
7-Segment Display
Now that you have tested your 7-segment display and have wired it to all eight GPIO
pins of your computer, you are ready to write some Python programs to control it:
1.
Create a new program by choosing File
➪
New File and, and save it as
testDisplay.py
.
2.
Import all the necessary modules and set some constants for each of the eight
GPIO numbers: