I have Problems to get I2C running. Following enviroment:
NodeMCU ESP-12E
Arduino IDE
wire.h Libary
I tried all this in regards of HW:
- Connection of SDA and SCL to different Pins (D1/D2, D4/D5, etc.)
- with and without 4,7k pull ups
- diffenrent I2C modules (SSD1306 Display, 2x BME280 sensors, ..)
- different ESP-12E boards
- different wiring
For my sketch I tried very simple implementations like the I2S Scanner:
#include <Wire.h>
void setup()
{
Wire.begin(4,5); //also tried different Pins like 0,2 or D1,D2
Serial.begin(9600);
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.print(address,HEX);
Serial.println(" !");
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);
}
I also tried differnt sketches and also some WIRE.h Options like
Wire.setClock(clockFrequency) with 100000, 400000, 80000 etc
and
Wire.pins(sda, scl).
All same result: I dont get I2C running. No devices found...
Any idea???