Raspberry Pi GPIO Library  0.3
Library allowing for control of the Raspberry Pi's GPIO pins.
GPIO

GPIO Pins

Attention
Take care when wiring up any GPIO pin. Doing so incorrectly could potentially do damage for instance shorting out a positive rail and ground.

Layout

There are currently two main PCB revisions of the Raspberry Pi, which have different pinouts on the P1 header. Additionally the rev2 has an additional P5 header which is unpopulated as standard. This library does not currently support the additional pins available on the P5 header. As documented here: http://elinux.org/RPi_HardwareHistory you can identify which PCB revision you have by running the following command: cat /proc/cpuinfo Any revision from 0004 onwards should be PCB rev2 (unless a rev3 is released). The following site contains useful informatoin on the GPIO pins http://elinux.org/RPi_Low-level_peripherals.

Rev1 P1 Header Layout

Pin 1 should be labeled such on the PCB and should also be the closest pin to the SD card.

         _______
 3V3    |  1  2 | 5V
 GPIO00 |  3  4 | DNC
 GPIO01 |  5  6 | GND
 GPIO04 |  7  8 | GPIO14
 DNC    |  9 10 | GPIO15
 GPIO17 | 11 12 | GPIO18
 GPIO21 | 13 14 | DNC
 GPIO22 | 15 16 | GPIO23
 DNC    | 17 18 | GPIO24
 GPIO10 | 19 20 | DNC
 GPIO09 | 21 22 | GPIO25
 GPIO11 | 23 24 | GPIO08
 DNC    | 25 26 | GPIO07
         _______
 

Rev2 P1 Header Layout

Pin 1 should be labeled such on the PCB and should also be the closest pin to the SD card.

         _______
 3V3    |  1  2 | 5V
 GPIO02 |  3  4 | 5V
 GPIO03 |  5  6 | GND
 GPIO04 |  7  8 | GPIO14
 GND    |  9 10 | GPIO15
 GPIO17 | 11 12 | GPIO18
 GPIO27 | 13 14 | GND
 GPIO22 | 15 16 | GPIO23
 3V3    | 17 18 | GPIO24
 GPIO10 | 19 20 | GND
 GPIO09 | 21 22 | GPIO25
 GPIO11 | 23 24 | GPIO08
 GND    | 25 26 | GPIO07
         _______
 

Numbering

All references to GPIO pin numbering is this code refers to the pin number as it is on the BCM2835 chip, i.e. in the diagram above GPIOxx. This is notably different from the physical pin layout on the Raspberry Pi.