Write a simple test routine that draws a line on the display.
I wrote a quick function test for the UNO. It just draws a short line. Works great on the UNO, not at all on the ESP. see below.
The same code loads in the ESP ok and responds to the I2C scanner sketch and returns: 0X3C address. So the display is communicating but not displaying a line.
The Uno is a 5V device, the ESP is 3.3V?
No, the esp runs off USB or 6-12 plug looks just like the UNO.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
void setup() {
Serial.begin(9600);
display.clearDisplay();
display.begin(SSD1306_SWITCHCAPVCC, 0x3c); // initialize with the I2C addr 0x3D (for the 128x64)
display.drawPixel( 10 , 10 , WHITE);
display.drawPixel( 10 , 11 , WHITE);
display.drawPixel( 10 , 12 , WHITE);
display.drawPixel( 10 , 13 , WHITE);
display.drawPixel( 10 , 14 , WHITE);
display.drawPixel( 10 , 15 , WHITE);
display.drawPixel( 10 , 16 , WHITE);
display.drawPixel( 10 , 17 , WHITE);
display.drawPixel( 10 , 18 , WHITE);
display.drawPixel( 10 , 19 , WHITE);
display.drawPixel( 10 , 20 , WHITE);
display.drawPixel( 10 , 21 , WHITE);
display.display();
}
void loop() {
}