you're right. I also forgot to mention that i'm using the Adafruit MCP23017 library
I have a multiplexed grid of LED's connected to the expander.
Here's my code:
Code:
#include <Wire.h>
#include "Adafruit_MCP23017.h"
Adafruit_MCP23017 mcp;
void setup() {
mcp.begin(1); // address is 1
for(int i=0;i<16;i++){
mcp.pinMode(i, OUTPUT);
mcp.digitalWrite(i, LOW);
}
mcp.digitalWrite(10, HIGH);//row 4
mcp.digitalWrite(7, HIGH);//row 3
mcp.digitalWrite(4, HIGH);//row 2
mcp.digitalWrite(1, HIGH);//row 1
}
void loop() {
mcp.digitalWrite(12, HIGH); // col 1
mcp.digitalWrite(15, LOW); // col 4
delay(100);
mcp.digitalWrite(15, HIGH); // col 4
mcp.digitalWrite(14, LOW); // col 3
delay(100);
mcp.digitalWrite(14, HIGH); // col 3
mcp.digitalWrite(13, LOW); // col 2
delay(100);
mcp.digitalWrite(12, LOW); // col 1
mcp.digitalWrite(13, HIGH); // col 2
delay(100);
}
could it be the library? its based on the Wire.h but I see absolutely no reason why it wouldn't be working.