-->
Page 1 of 2

Does Any One Have A Software I2C Library For ESP8266

PostPosted: Thu May 19, 2016 4:40 pm
by Ghassan Yusuf
Dear Friends

I bought a node mcu dev kit v3 (please see the attachments). the one that looks like an arduino and could be programed via micro USB cable. now i was planning to build an application the allowes me to read from MPU9250 9DOF Sensor. But the problem is that dev kit dosent have any I2C pins, i have tried to look for sample codes that might work but sadly i am unlucky i never got it to work. so would any one please tell me where to find a suitable library for

    1. MPU9250 That is compatible with Node MCU Devkit V3 In Arduino Platform
    2. Software I2C Library That Is Compatible With Node MCU Devkit V3 In Arduino Plat Form

Please If Any Of You Have An Idea

Re: Does Any One Have A Software I2C Library For ESP8266

PostPosted: Thu May 19, 2016 4:55 pm
by martinayotte
The Wire library that comes with Arduino ESP framework is already an Software I2C, simply need to provide on which pins you wish to use it.

https://github.com/esp8266/Arduino/tree ... aries/Wire

or if you have it already installed :

.arduino15/packages/esp8266/hardware/esp8266/2.2.0/libraries/Wire

Re: Does Any One Have A Software I2C Library For ESP8266

PostPosted: Thu May 19, 2016 5:22 pm
by Barnabybear
Hi, +1 on that and it works a treat.
You need to:
#include <Wire.h>
Set GPIO's to be used:

Code: Select allWire.begin(2,0); //start Wire and set SDA - SCL  // Note 1

Then send some data:

Code: Select allWire.beginTransmission(0x41);  //Note 2
Wire.write(00);  // Note 3
Wire.write(0xa1);   // Note 4
Wire.endTransmission();   // Note 5


Note 1: GPIO's 0 & 2 are good, as like I2C lines they have to be pulled high (10K works for short distances - 4.7K is better).
Note 2: Adds the address of the device to be communicated with to the output buffer.
Note 3: Adds some data to the output buffer.
Note 4 : Adds some more data to the output buffer.
Note 5: Writes the contents of the buffer.

You will be reading but it should be just as easy.

Re: Does Any One Have A Software I2C Library For ESP8266

PostPosted: Fri May 20, 2016 4:32 am
by Ghassan Yusuf
well about the wire library i think its working but no data is coming out from the mpu9250 :( plz help

i swaped the pins in the wire begin an tried again it didnt work too.

may be because i didnt add the pull up resistors ?!