Giter Site home page Giter Site logo

erriez / erriezmcp23017 Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 2.0 1.25 MB

Erriez MCP23017 16-pin I2C IO-expander library for Arduino

Home Page: https://github.com/Erriez/ErriezArduinoLibrariesAndSketches

License: MIT License

C++ 100.00%
erriez mcp23017 i2c smbus io expander 16-pins arduino library examples

erriezmcp23017's Introduction

MCP23017 16-pin I2C IO-expander library for Arduino

Build Status

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

  • 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.

Documentation

Getting started LED blink

#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

erriezmcp23017's People

Contributors

erriez avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.