I'm using MCP23017 connected to the ESP32. I want to know how to use the Adafruit_MCP23017.h to custom pins.
I'm googling to find how to use the Adafruit_MCP23017.h for custom I2C pins, but I couldn't find any result.
I wrote the codes below myself, but it does not work.
Any help would be appreciated.
Code: Select all
#define IO_SCL 4
#define IO_SDA 16
Adafruit_MCP23017 IO_Expander_Class;
TwoWire I2CBME = TwoWire(0);
void setup()
{
Serial.begin(115200);
I2CBME.begin(IO_SDA ,IO_SCL,40000); // wake up I2C bus
///IO_Expander_Init();
IO_Expander_Class.begin(0x27,&I2CBME);
IO_Expander_Class.pinMode(4, OUTPUT);
IO_Expander_Class.digitalWrite(4, HIGH);
}
void loop{
Serial.print("LITE2 OFF");
Serial.print("\n");
IO_Expander_Class.digitalWrite(4, HIGH);
delay(1000);
Serial.print("LITE2 OFF");
Serial.print("\n");
IO_Expander_Class.digitalWrite(4, LOW);
delay(1000);
}