Thanks @MORA and @peter_a ! (LINK)
So, to summarize how I understand it:
For the above “toggle.ino” sketch I will change as shown in BOLD:
Adafruit_MCP23017 mcp;
Adafruit_MCP23017 secondmcp;
void setup()
{
mcp.begin(); //implicit (0)
secondmcp.begin(1);
mcp.pinMode(0, OUTPUT);
mcp.pinMode(16, OUTPUT);
// I assume chip 1 has pins 0 - 15 and chip 2 has pins 16 - 31
}
// flip the pin #0 and #16 up and down
void loop()
{
delay(100);
mcp.digitalWrite(0, HIGH);
mcp.digitalWrite(16, HIGH);
delay(100);
mcp.digitalWrite(0, LOW);
mcp.digitalWrite(16, LOW);
}
Do you think this is correct?