Closed structure7 closed 8 years ago
Kind of another mention of this:
In theory you can use any pins for I2C and SPI but to make it easier for people using existing Arduino code, libraries, sketches we set up the following: I2C SDA = GPIO #4 (default) I2C SCL = GPIO #5 (default) If you want, you can connect to I2C devices using other 2 pins in the Arduino IDE, by calling Wire.pins(sda, scl) before any other Wire code is called (so, do this at the begining of setup() for example
...from https://learn.adafruit.com/adafruit-feather-huzzah-esp8266/pinouts#i2c-and-spi-pins
The above doesn't work (at least not with the default Arduino Wire.h)... it didn't compile.
***NOTE: I removed #include <Wire.h>
from the sketch, changed the board from Uno to ESP-12E, then re-added Wire.h... it compiled!!! Still didn't work! But might be a lead!
With Wire.h compiling (still not 100% convinced it's the right one) trying things:
Wire.pins(5,4);
in setup didn't do anything.Wire.begin(4,5);
in setup also didn't do anything.*Tested correlation between IDE pin 5 = D1 and IDE pin 4 = D2 using blink, just to be sure!!!
Hold the horn... Ada SSD1306 is calling #define OLED_RESET 4
that might be hijacking my pin 4.
I could cry. Finally solved it! The reset was "fouling" my pin 4... any other pin choice and I probably would have been fine! Therefore:
#define OLED_RESET 0
This change to 0 did it!
This references the ESP-01 specifically but probably need to at least experiment with it: https://github.com/adafruit/ESP8266-Arduino#i2c-wire-library (just noticed that's an Adafruit fork... hmmm... might need to compare the source files).
From ada: