Jump to content

ESP8266 D1 Mini not working with SSD1306 screen

Hi!

I've had this idea for a clock for my motorcycle as it doesn't have one and knowing the time is useful as I commute with it. So I thought, get a ESP8266 D1 Mini, a tiny screen and a realtime clock module, wire it up, somehow figure out the code and install the thing. But no matter what I tried, I never managed to get the display to output anything (and idk if it works as it being an oled it does not light up or anything without video signal anyways). I've tried another D1 mini, bought a new screen and replaced the wires multiple times along with using tons of different software examples. My screen supports both i2c and spi, both of which I've tried. I tripple checked I had all the necessary libraries, everything was up to date but no luck. Anyone know what the problem could be? Here the current code (not mine): (Pins GND - GND, VCC - 3.3v, SCL - D1, SDA - D2)

 

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
 
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
 
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
 
void setup() {
Serial.begin(115200);
 
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
delay(2000);
display.clearDisplay();
 
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 10);
// Display static text
display.println("Hello, world!");
display.display();
}
 
void loop() {
 
}


Thanks for the potential answers and the read!
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×