Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By torntrousers
#17836
tytower wrote:I have found this page
from
http://devacron.com/arduino-ide-for-esp8266/
I2C (Wire library)

Only master mode works, and Wire.setClock has not been verified to give exactly correct frequency. Before using I2C, pins for SDA and SCL need to be set by calling Wire.pins(int sda, int scl), i.e.Wire.pins(0, 2); on ESP-01.


I tried " Wire.pins(3, 4);" Also tried "Wire.pins(3 sda, 4 scl);"
but it will not compile with the line in .Complains of wire not having a type? I dont see the function at all in the Wire library which is built in to the Arduino IDE nor Wire.setClock() mentioned in the quote


The Wire library has a mod to work with ESP8266. Thats in the ESP version of the Arduino IDE at - hardware\esp8266com\esp8266\libraries\Wire - but if you happen to have the Wire lib in your Arduino libraries folder (eg Documents\Arduino\libraries) than that will get picked up first not the modified ESP one, so you need to delete that old one.
User avatar
By tytower
#17837 Got to check that out
This from the latest Arduino IDE 1.6.4 with ESP8266 library
https://github.com/esp8266/Arduino
I2C (Wire library)

Wire library currently supports master mode up to approximately 450KHz. Before using I2C, pins for SDA and SCL need to be set by calling Wire.begin(int sda, int scl), i.e. Wire.begin(0, 2); on ESP-01, else they default to pins 4(SDA) and 5(SCL).