But I've come up against a problem (well a few) that I just cannot figure out and I'm hoping someone can help: I2C simply refuses to work or be recognized.
I have an ESP12 (not the NodeMCU, just the chip soldered to a breakout board) connected with an FTDI. I've had this chip connected to my local network, gotten OTA working on it, and hooked up the MFRC522 via SPI to it, all without issue. Now I am trying to connect an OLED using I2C to it (without anything else connected) and it just will not work (I should also mention I have a regulated 3.3V external power supply connected)
I tried using several SSD1306 libraries including this one that has been recommended here by others: https://github.com/squix78/esp8266-oled-ssd1306
I've tried using Wire with GPIO 4,5 using Wire.begin(4,5) (also 5,4 just in case). I've tried GPIO 2,0 (and 0,2) with Wire.begin() and no matter what I do the OLED will never even turn itself on.
Using the exact same ssd1306 library, sketch and OLED hooked up to an Arduino UNO on A4 and A5 the OLED works 100% fine, so I know its not the actual screen.
So I guess my question is, what are the pins I should be trying with the OLED to get it to work? I have seen about 700 different versions of pin-outs online and am utterly confused.
The sketch I've been using is very basic just to get it to turn on. Any help at all is appreciated!
#include "SSD1306.h" // alias for `#include "SSD1306Wire.h"`
// Initialize the OLED display using Wire library
SSD1306 display(0x3c, 4, 5); //display(I2C address, SDA, SCL)
// Wemos D1 + SD1306 display(I2C address, SDA = D2, SCL = D1)
// ESP-12 + SD1306 display(I2C address, SDA = GPIO4, SCL = GPIO5)
void setup() {
Wire.begin(4,5);
Serial.begin(115200); //for debug by terminal
Serial.println(); //for debug by terminal
Serial.println("Debug"); //for debug by terminal
display.init(); // Initialising the UI will init the display too.
display.flipScreenVertically(); // up side down or straight
display.setFont(ArialMT_Plain_10); //default font. Create more fonts at http://oleddisplay.squix.ch/
}
void loop() {
String MyTekst = "Hello world";
display.clear(); // clear the display
display.setFont(ArialMT_Plain_24); // change font
display.drawString(0, 26, MyTekst); // draw string (column(0-127), row(0-63, "string")
display.display(); //display all you have in display memory
delay(10); // give some time to finish function loops
}