MCP23017 with ESP32: I2C Address Setup and 16 GPIO Pins

A complete guide to the MCP23017 I/O expander with schematics. Add 16 GPIO pins to an ESP32 over I2C, set the address with A0–A2, and drive 8 LEDs and 3 switches with the Adafruit_MCP23X17 library. Step by step, with full sample code.

September 30, 2021 · Updated: July 20, 2026 · 10 min ·