Erriez MCP23017 library for Arduino  1.0.0
This is a MCP23017 16-pin I2C IO-Expander library for Arduino by Erriez.
MCP23017 16-pin I2C IO-expander library for Arduino

This is a MCP23017 16-pin I2C IO-expander library for Arduino with interrupt change/edge support and extensive examples.

MCP23017 16-pin I2C IO-expander

Library features

Hardware

The following targets are supported:

Examples

Extensive examples are located here.

Documentation

Getting started LED blink

{c++}
#include <Arduino.h>
#include <Wire.h>
#include <ErriezMCP23017.h>
// 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 page.

Other Arduino Libraries and Sketches from Erriez

Erriez Libraries and Sketches