Basic library to interface to a Microchip MCP23016 I/O expander using I2C
Testing code to blink 2 lights
#include "mbed.h" #include "MCP23016.h" MCP23016 PortExpand(D4, D5, 0); DigitalOut myled(LED1); int main() { PortExpand.pinMode(0, DIR_OUTPUT); PortExpand.pinMode(8, DIR_OUTPUT); while(1) { PortExpand.digitalWrite(0, 1); PortExpand.digitalWrite(8, 0); myled = 1; // LED is ON wait(1); // 200 ms PortExpand.digitalWrite(0, 0); PortExpand.digitalWrite(8, 1); myled = 0; // LED is OFF wait(1); // 1 sec } }
History
MCP23016 Library
2016-01-19, by davidr99 [Tue, 19 Jan 2016 23:50:23 +0000] rev 0
MCP23016 Library