I'm trying to debug a sketch & standalone Arduino. I've made up a board with a pair of MCP23008 - one has address 0x21 and is reading a matrix keypad, the other has address 0x20 with all address lines pulled to GND and I was hoping to use the Adafruit MCP library to read 8 pushbuttons using the internal pull-up resistors. On the I2C bus I also have a 2004 LCD and a DS1307 RTC. Each works fine in isolation aside from the MCP23008 on the pushbuttons- it hangs at mcp.begin() as evidenced by this code below never turning my LED on D5 on. For debugging purposes, this is the button example from the Adafruit library, slightly modified to address my activity LED which is on D5.
Code: Select all
Adafruit_MCP23008 mcp;
void setup() {
mcp.begin(); // use default address 0
//mcp.pinMode(0, INPUT);
// mcp.pullUp(0, HIGH); // turn on a 100K pullup internally
pinMode(5, OUTPUT); // use the p13 LED as debugging
digitalWrite(5, HIGH);
delay(1000);
digitalWrite(5, LOW);
}
Appreciate any advice you can offer,
Geoff