The wiringpi2 library has excellent support for I/O expander chips, like the one used for the Adafruit LCD character module. To use the Adafruit module, we need to set up the pin mapping for all the pins of MCP23017 Port A, as shown in the following table (then, we set up the I/O expander pins with an offset of 100):
Name |
SELECT |
RIGHT |
DOWN |
UP |
LEFT |
GREEN |
BLUE |
RED |
MCP23017 Port A |
A0 |
A1 |
A2 |
A3 |
A4 |
A6 |
A7 |
A8 |
WiringPi pin |
100 |
101 |
102 |
103 |
104 |
106 |
107 |
108 |
The pin mapping for all of MCP23017 Port B's pins is as follows:
Name |
DB7 |
DB6 |
DB5 |
DB4 |
E |
RW |
RS |
MCP23017 Port B |
B1 |
B2 |
B3 |
B4 |
B5 |
B6 |
B7 |
WiringPi pin |
109 |
110 |
111 |
112 |
113 |