Arduino library for MCP23008/9 I2C I/O expanders. Enables easy control of digital inputs/outputs via I2C.
# Adafruit MCP23008 Library (ARCHIVED)
**This library is archived and no longer maintained. Please use the replacement library:**
[Adafruit MCP23017 Arduino Library](https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library)
[](https://github.com/adafruit/Adafruit-MCP23008-library/actions)
[](http://adafruit.github.io/Adafruit-MCP23008-library/html/index.html)
This library provides basic functionality for interfacing with the Microchip MCP23008 8-bit I/O expander using the Arduino platform.
## Installation
1. **Download:** Click "Download Source" in the top right corner of this page.
2. **Install:** Follow the instructions in the Adafruit Arduino Libraries tutorial: [http://www.ladyada.net/library/arduino/libraries.html](http://www.ladyada.net/library/arduino/libraries.html). Create a folder named `Adafruit_MCP23008` in your Arduino libraries directory and place the contents of the downloaded archive there.
3. **Dependencies:** This library requires the [Adafruit BusIO library](https://github.com/adafruit/Adafruit_BusIO). Please install it as well.
## Functionality
This library provides the following basic functionality:
* Setting pin directions (INPUT or OUTPUT).
* Reading digital input values.
* Writing digital output values (HIGH or LOW).
* Enabling/disabling internal pull-up resistors.
**Limitations:**
* This library is considered beta and may not be fully optimized.
* The interrupt capability of the MCP23008 is **not** currently supported.
## Wiring
Connect the MCP23008 to your Arduino as follows:
* **Pin 1 (SCL):** Arduino Analog 5 (I2C clock)
* **Pin 2 (SDA):** Arduino Analog 4 (I2C data)
* **Pins 3, 4, 5 (A0, A1, A2):** Ground (Address selection - all grounded sets the I2C address to 0x20)
* **Pins 6 (RESET) & 18 (VDD):** 5V (Power and reset disable - tying RESET high disables the reset function)
* **Pin 9 (VSS):** Ground (Common ground)
* **Pins 10-17 (GP0-GP7):** Digital Input/Output pins
**Note:** The I2C address of the MCP23008 can be configured using pins A0, A1, and A2. Consult the datasheet for address selection details.
## Datasheet
For more detailed information about the MCP23008, please refer to the datasheet:
[http://ww1.microchip.com/downloads/en/DeviceDoc/21919b.pdf](http://ww1.microchip.com/downloads/en/DeviceDoc/21919b.pdf)
## Contributing
Pull requests are welcome! Please feel free to contribute improvements and bug fixes. However, note that this library is archived, so contributions may not be actively reviewed.
adafruit/Adafruit-MCP23008-library
September 1, 2010
June 9, 2025
C++