Extensions

WiringPi supports a number of extensions. These extensions allow your programs to use additional hardware in a seamless fashion to using the Pi’s on-board GPIO.

For example – you may have an MCP23017 I2C GPIO expander chip (e.g. on the Quick 2 Wire board) to extend wiringPi with this chip, you just need to know its I2C bus address (usually 0x20), then integrate it in your program as follows:

#include <wiringPi.h>
#include <mcp23017.h>

and call:

wpi23017Setup (120, 0x20) ;

And from then, you can use the standard pinMode(), digitalWrite() and digitalRead() functions as before, but use 120 as the base of the device. If you had 16 LEDs connected to it and wanted to turn them all on:

for (i = 0 ; i < 16 ; ++i)
{
  pinMode (120 + i, OUTPUT) ;
  digitalWrite (120 + i, HIGH) ;
}

and so on.

similar setups exist for a number of GPIO expander chips and more are being added all the time. If you have a specific requirement then do get in-touch, or consider writing your own!

Pins 0-63 are reserved for the Raspberry Pi’s own on-board GPIO, but there is almost no limit to the pins and range you may use for your own hardware (subject to the limits of an signed 32-bit integer)