https://github.com/erriez/erriezmcp23017
Erriez MCP23017 16-pin I2C IO-expander library for Arduino
https://github.com/erriez/erriezmcp23017
16-pins arduino documentation erriez esp32 esp8266 examples expander getting i2c interrupt io library mcp23017 polling smbus started tested uno
Last synced: 29 days ago
JSON representation
Erriez MCP23017 16-pin I2C IO-expander library for Arduino
- Host: GitHub
- URL: https://github.com/erriez/erriezmcp23017
- Owner: Erriez
- License: mit
- Created: 2020-04-08T19:25:19.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-06T09:34:12.000Z (over 5 years ago)
- Last Synced: 2025-04-06T21:33:49.251Z (about 1 year ago)
- Topics: 16-pins, arduino, documentation, erriez, esp32, esp8266, examples, expander, getting, i2c, interrupt, io, library, mcp23017, polling, smbus, started, tested, uno
- Language: C++
- Homepage: https://github.com/Erriez/ErriezArduinoLibrariesAndSketches
- Size: 1.23 MB
- Stars: 1
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MCP23017 16-pin I2C IO-expander library for Arduino
[](https://travis-ci.org/Erriez/ErriezMCP23017)
This is a MCP23017 16-pin I2C IO-expander library for Arduino with interrupt change/edge support and extensive examples.

## Library features
* I2C interface
* Input/output/read/write/toggle/mask control per pin or per 16-pins
* Configurable pullup per pin
* Interrupt change/falling/rising per pin
* Interrupt edge handled by the library, because the chip supports pin change / level only.
* Low-power support
* Generic examples / AVR / ESP8266 / ESP32 support
## Hardware
The following targets are supported:
* AVR: UNO, MINI, Pro Mini 8/16 MHz, ATMega2560, Leonardo
* ARM: DUE
* ESP8266: Mini D1 & D2, NodeMCU
* ESP32: Lolin D32
## Examples
Extensive examples are located [here](https://github.com/Erriez/ErriezMCP23017/tree/master/examples).
## Documentation
- [Online HTML](https://erriez.github.io/ErriezMCP23017)
- [Download PDF](https://github.com/Erriez/ErriezMCP23017/raw/master/ErriezMCP23017.pdf)
**Getting started LED blink**
```c++
#include
#include
#include
// PORTA: pins 0..7
// PORTB: pins 8..15
#define LED_PIN 8 // Pin B0
// Default I2C Address 0x20
#define MCP23017_I2C_ADDRESS 0x20
// Create MCP23017 object
ErriezMCP23017 mcp = ErriezMCP23017(MCP23017_I2C_ADDRESS);
void setup()
{
// Initialize Wire
Wire.begin();
Wire.setClock(400000);
// Initialize MCP23017
while (!mcp.begin()) {
// MCP23017 not detected
delay(3000);
}
// LED pin output
mcp.pinMode(LED_PIN, OUTPUT);
}
void loop()
{
mcp.digitalWrite(LED_PIN, HIGH);
delay(1000);
mcp.digitalWrite(LED_PIN, LOW);
delay(1000);
}
```
## Library installation
Please refer to the [Wiki](https://github.com/Erriez/ErriezArduinoLibrariesAndSketches/wiki) page.
## Other Arduino Libraries and Sketches from Erriez
[Erriez Libraries and Sketches](https://github.com/Erriez/ErriezArduinoLibrariesAndSketches)