Chat freely about anything...

User avatar
By Vlado93
#53072 Hello everyone,

I rarely used I2C protocol in the past and recently I have successfully connected an ESP8266 12E model with two different sensor modules. The problem is that I am a confused about usage of I2C pins. I connected SCL and SDA to GPIO4 and GPIO5 respectively (as labeled on some pinouts of the module) and everything works fine. However, in the official documentation it is written that for the SDA and the SCL pins GPIO2 and MTMS (GPIO14) should be used. I tried using pins according to the documentation and calling function Wire.pins to select appropriate pins, but it didn't work. Anyone can clarify this to me?

Cheers,
Vladimir
User avatar
By martinayotte
#53077 Since the I2C Wire library is bit-banging, it could be used with almost any GPIOs.
I'm personally using it with GPIO2/GPIO0 since those 2 pins as already some pullups for the boot mode.
The only thing you need to do is providing the pin number in Wire.begin(0, 2);
User avatar
By calculathor
#58594
martinayotte wrote:Since the I2C Wire library is bit-banging, it could be used with almost any GPIOs.
I'm personally using it with GPIO2/GPIO0 since those 2 pins as already some pullups for the boot mode.
The only thing you need to do is providing the pin number in Wire.begin(0, 2);


hi, i want to use esp8266 in slave mode with address 9.
so i need to do Wire.begin(9); right?
so how do i incorporate Wire.begin(0, 2)?
should i use
Wire.pins(0,2);
Wire.begin(9);

thanks