Unable to configure ESP32-WROOM-30 in I2C master mode with Wire.begin(2, 4)
My code is OK with Wire.begin(14, 15) or Wire.begin(21, 22)
Thanks in advance https://gelit.ch/
#include <Wire.h> // I2C library
#include <SparkFunSX1509.h> // http://librarymanager/All#SparkFun_SX1509
#define I2C_SDA 2 //14 // default=21
#define I2C_SCL 4 //15 // 22
SX1509 io; // Create object
void setup() {
Wire.begin(I2C_SDA, I2C_SCL);
Serial.begin(115200);
Serial.println("GL1-SX1509");
if (io.begin(0x3E) == false)
{
Serial.println("Failed to communicate. Check wiring and address of SX1509.");
while (1);
}
io.pinMode(1,OUTPUT);
}
void loop() {
io.digitalWrite(1,1); delay(2000);
io.digitalWrite(1,0); delay(2000);
}
Unable to configure ESP32-WROOM-30 in I2C master mode with Wire.begin(2, 4)
-
lbernstone
- Posts: 1132
- Joined: Mon Jul 22, 2019 3:20 pm
Re: Unable to configure ESP32-WROOM-30 in I2C master mode with Wire.begin(2, 4)
gpio 2&4 have pulldowns on boot. This may confuse the connected device. Try to put a delay (maybe ~250ms) in your setup before you init the i2c. You can use the WireScan example to test how long a delay is needed.
Re: Unable to configure ESP32-WROOM-30 in I2C master mode with Wire.begin(2, 4)
Good idea but same error with delay(1000); at begin of setup
-
lbernstone
- Posts: 1132
- Joined: Mon Jul 22, 2019 3:20 pm
Re: Unable to configure ESP32-WROOM-30 in I2C master mode with Wire.begin(2, 4)
Well, it must be something electrical on your system. It works fine in emulation. Check if the scan example works.
https://wokwi.com/projects/434526065481900033
https://wokwi.com/projects/434526065481900033
Re: Unable to configure ESP32-WROOM-30 in I2C master mode with Wire.begin(2, 4)
Thanks I have tried with SSD1306 and test is OK
Who is online
Users browsing this forum: No registered users and 1 guest