Raspberry Pi A User Manual page 242

Hide thumbs Also See for Raspberry Pi A:
Table of Contents

Advertisement

226
P A R T I V
H A R D W A R E H A C K I N G
Figure 14-3:
A breadboard
circuit for a
simple LED
output
Remember that Python is case-sensitive, so be sure to type
exactly as it appears.
RPi.GPIO
To allow Python to understand the concept of time (in other words, to make the LED blink,
rather than just turning it on and off), you'll also need to import the time module. Add the
following line to the project:
import time
With the libraries imported, it's time to address the GPIO ports. The GPIO library makes it easy to
address the general-purpose ports through the instructions
and
,
GPIO.output
GPIO.input
but before you can use them, you'll need to set the GPIO library in board mode—which numbers
the pins according to their physical position on the Raspberry Pi—and initialise the pins as either
inputs or outputs. In this example, Pin 11 is an output, so add the following line to the project:
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)

Hide quick links:

Advertisement

Table of Contents
loading

Related Products for Raspberry Pi Raspberry Pi A

This manual is also suitable for:

Raspberry pi b

Table of Contents