Introduction
One of the key features of a Raspberry Pi computer that sets it apart from most other home/office computers is that it has the ability to directly interface with other hardware. The hardware General Purpose Input/Output (GPIO) pins on the Raspberry Pi can control a wide range of low-level electronics, from Light Emitting Diodes (LEDs) to switches, sensors, motors, servos, and even extra displays.
This chapter will focus on connecting the Raspberry Pi with some simple circuits and getting to grips with using Python to control and respond to the connected components.
The Raspberry Pi hardware interface consists of 26 pins (P1) located to the side of the analog video connector.
Note
The Model B Rev 2 version of the board (and Model A) also includes a secondary set of eight holes (P5) located next to P1. If an additional connector is soldered in place, it will be able to provide four additional GPIO pins (see Relocating to the P5 header in the A controlled shutdown button recipe for...