Understand Pin Addressing for MCP23x08 and MCP23x17
masterWhen performing single pin operations such as pinMode(pinId, dir), digitalRead(pinId), or digitalWrite(pinId, val), you must use the specific pinId assigned to that pin.
Note: The MCP23008 and MCP23S08 chips only have GPAx pins (IDs 0-7). The MCP23x17 chips include GPBx pins (IDs 8-15).
| Pin Name | MCP23x08 Pin # | MCP23x17 Pin # | Pin ID |
|---|---|---|---|
| GPA0 | 10 | 21 | 0 |
| GPA1 | 11 | 22 | 1 |
| GPA2 | 12 | 23 | 2 |
| GPA3 | 13 | 24 | 3 |
| GPA4 | 14 | 25 | 4 |
| GPA5 | 15 | 26 | 5 |
| GPA6 | 16 | 27 | 6 |
| GPA7 | 17 | 28 | 7 |
| GPB0 | -- | 1 | 8 |
| GPB1 | -- | 2 | 9 |
| GPB2 | -- | 3 | 10 |
| GPB3 | -- | 4 | 11 |
| GPB4 | -- | 5 | 12 |
| GPB5 | -- | 6 | 13 |
| GPB6 | -- | 7 | 14 |
| GPB7 | -- | 8 | 15 |