Hi guys.
I have been using the mcp23017 for quite a while now, but now I can't get it to work for some reason. I tried everything I know, maybe you can help me.
Hardware:
- ESP32
- mcp23017
- Breadboard + Jumper Cables
- 4k7 resistors
Software: - Platform IO on VS Code
- I2C Scanner (code on the bottom)
Address pins on mcp are Low, so there should be address 0x20. SDA & SCL are pulled up to 3.3V with 4k7 ohm resistors. VSS is connected to Ground, VDD is connected to 3.3V as well as RESET. I checked all connections for continuity with my multimeter, no problems there. I used 3 different mcp's already, still, nothing works.
I'm going crazy because I used them quite successfully before and now I can't even get the I2C Scanner to work. If you have any ideas please let me know. Thank you!
Wiring Picture:
Blue->SDA | Yellow->SCL | Gray->GND | Orange->3.3V
I2C Scanner:
#include <Arduino.h>
/*********
Rui Santos
Complete project details at https://randomnerdtutorials.com
*********/
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(115200);
Serial.println("\nI2C Scanner");
}
void loop() {
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ ) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address<16) {
Serial.print("0");
}
Serial.println(address,HEX);
nDevices++;
}
else if (error==4) {
Serial.print("Unknow error at address 0x");
if (address<16) {
Serial.print("0");
}
Serial.println(address,HEX);
}
}
if (nDevices == 0) {
Serial.println("No I2C devices found\n");
}
else {
Serial.println("done\n");
}
delay(5000);
}