ESP32 and 1306 OLED - Any Ideas?

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
xFishbonex
 
Posts: 11
Joined: Fri Jan 27, 2023 12:17 pm

ESP32 and 1306 OLED - Any Ideas?

Post by xFishbonex »

Hi. I'm running Windows 10 with PlatformIO and tried this simple "Hello World"

Code: Select all

#include <Arduino.h>
/*********
  Rui Santos
  Complete project details at https://randomnerdtutorials.com  
*********/

#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() {
  
}
I get this:
Image

I tried a second display and the outcome was the same. I also tried the other I2C connection and also got the same thing. Any help is appreciated!

Mark

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: ESP32 and 1306 OLED - Any Ideas?

Post by adafruit_support_mike »

Try adding 10k pull-up resistors on the SDA and SCL lines. Some versions of the ESP32 don't have them.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”