#include <Wire.h>
#include <MCP23017.h>
MCP23017 mcp0 = MCP23017(0x20);
MCP23017 mcp1 = MCP23017(0x21);
MCP23017 mcp2 = MCP23017(0x22);
MCP23017 mcp3 = MCP23017(0x23);
MCP23017 mcp4 = MCP23017(0x24);
MCP23017 mcp5 = MCP23017(0x25);
MCP23017 mcp6 = MCP23017(0x26);
MCP23017 mcp7 = MCP23017(0x27);
//Declaring the array of objects
MCP23017 mcp[] = {
mcp0,
mcp1,
mcp2,
mcp3,
mcp4,
mcp5,
mcp6,
mcp7
};
void setup() {
Serial.begin(9600);
for(int i=0; i < 8; i++) {
//Using a function of an object within the array
mcp[i].init;
}
}
void loop() {
}