Table of Contents
A GPIO pin designated as an output pin can be set to high (3V3) or low (0V).
A GPIO pin designated as an input pin can be read as high (3V3) or low (0V). This is made easier with the use of internal pull-up or pull-down resistors. Pins GPIO2 and GPIO3 have fixed pull-up resistors, but for other pins this can be configured in software.
As well as simple input and output devices, the GPIO pins can be used with a variety of alternative functions, some are available on all pins, others on specific pins.
- PWM (pulse-width modulation)
- Software PWM available on all pins
- Hardware PWM available on GPIO12, GPIO13, GPIO18, GPIO19
- SPI0: MOSI (GPIO10); MISO (GPIO9); SCLK (GPIO11); CE0 (GPIO8), CE1 (GPIO7)
- SPI1: MOSI (GPIO20); MISO (GPIO19); SCLK (GPIO21); CE0 (GPIO18); CE1 (GPIO17); CE2 (GPIO16)
- Data: (GPIO2); Clock (GPIO3)
- EEPROM Data: (GPIO0); EEPROM Clock (GPIO1)
- TX (GPIO14); RX (GPIO15)
A handy reference can be accessed on the Raspberry Pi by opening a
terminal window and running the command
pinout. This tool is provided
by the GPIO Zero Python library,
which it is installed by default on the Raspbian desktop image, but not
on Raspbian Lite.
For more details on the advanced capabilities of the GPIO pins see gadgetoid's interactive pinout diagram.