Download Print this page
Raspberry Pi A Quick Start Manual

Raspberry Pi A Quick Start Manual

Python gpio guide
Hide thumbs Also See for A:

Advertisement

Quick Links

create.withcode.uk
Raspberry Pi Python GPIO Quick start guide
The GPIO pins on a Raspberry Pi allow you to connect your Pi up to all sorts of electronic devices. This guide talks you
through how to set up and control the inputs and outputs using python.
GPIO stands for General Purpose Input and Output.
GPIO pins are the metal spikes that stick out of a RPi.
Older RPis have 26 pins and newer ones have 40 pins.
Some of those pins are for power rather than inputs or
outputs
Pins:
Pins are either power points or I/O pins
Power pins are hard wired to 0v (ground), +3.3v or +5v. You can't change them.
I/O pins can be set to either an input or an output
Inputs read a digital value into the RPi (e.g. has a switch been pressed?)
Output send a digital value out from the RPI (e.g. switch an LED on or off)
Pin numbering:
There are two numbering systems for GPIO pins.
Physical numbering is the easiest to understand: it tells you where to find the pin on the physical RPi board
(see below)
BCM numbers are only for I/O pins. They don't match the physical numbers but come from the way that
they are connected to the processor on the RPi.
When writing your code you can choose to use either physical numbering or BCM numbering
Pin 2
Pin 1
Warning:
You might permanently break your RPi if you're not careful when connecting anything to the GPIO pins.
Short circuits (connecting +3v or +5 either from a power pin or an output pin directly to ground) will
damage your RPi
Whilst your GPIO pins have power pins, there's a limit to how much power they can provide. You may need
an external power supply if you're controlling a circuit that needs anything more than a few LEDs &
switches.
Never connect a motor or speaker directly to a GPIO pin. The electrical feedback can cause damage.
RPi
Number
Number of
Model
of GPIO
inputs or
pins
A
26
B
26
A+
40
B+
40
Pins 27-40 not available on older RPi models
Pin 40
outputs
17
17
28
28

Advertisement

loading

Summary of Contents for Raspberry Pi A

  • Page 1 Raspberry Pi Python GPIO Quick start guide The GPIO pins on a Raspberry Pi allow you to connect your Pi up to all sorts of electronic devices. This guide talks you through how to set up and control the inputs and outputs using python.
  • Page 2 3 to be an output. Change GPIO.BOARD to GPIO.BCM if you want BCM pin numbering instead of physical pin numbering Change GPIO.OUT to GPIO.IN if you want to set a pin back to being an input Reading inputs and setting outputs...

This manual is also suitable for:

BA+