I need help with my Oled Display 128x32 i2c

I need help my Oled display is not turning on i even though i bought it yesterday and it was working fin then but once i took it out and after a day put it back it won't turn on or detect with an i2c address checker and i dont got money to buy a new one. heres the image and code

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128  // OLED display width
#define SCREEN_HEIGHT 32  // OLED display height

// Initialize the OLED display (without reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

void setup() {
  // Start I2C and Serial
  Wire.begin();
  Serial.begin(9600);
  Serial.println("\nI2C Scanner");

  // Initialize OLED display
  if (!display.begin(0x3C, SCREEN_WIDTH, SCREEN_HEIGHT)) { // Use 0x3C as the I2C address
    Serial.println("OLED initialization failed!");
    for (;;); // Halt execution
  }

  // Clear display and set initial text
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);
  display.println("I2C Scanner");
  display.display();

  bool deviceFound = false; // Flag to track if any device is found

  for (byte address = 1; address < 127; ++address) {
    Wire.beginTransmission(address);
    if (Wire.endTransmission() == 0) {
      Serial.print("I2C device found at address 0x");
      if (address < 16) Serial.print("0");
      Serial.println(address, HEX);

      // Update OLED display
      display.print("Found: 0x");
      if (address < 16) display.print("0");
      display.println(address, HEX);
      display.display();

      deviceFound = true;
      delay(10);
    }
  }

  if (!deviceFound) {
    Serial.println("No I2C devices found.");
    display.println("No I2C devices found.");
    display.display();
  }

  Serial.println("Done.");
  display.println("Scan Complete.");
  display.display();
}

void loop() {
  // No actions required in loop
}

Did You turn off all power before taking it out?

yes i always do

i just read some more topics and turns out since i bought mine very cheap it was prob a dud and cheaply made

Good. Even the old, robust TTL can get destroyd if power is still on.
Remains possible static electricity or a bad cable somewhere, bad point in a breadboard.

1 Like

My money is on the breadboard.

it was the bread borad thanks

Thanks for telling. Now You're back in business.

Post #5 @Railroader gets the Solution, not me. He said it first, I just re-inforced it.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.