1

I have a strange issue while trying to run the hello world code on an arduino nano connected to an OLED display.

This is the code I used:

    #include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire);

void setup() {

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Address 0x3C for 128x32

  display.display();
  delay(2000);

  display.clearDisplay();      //this line to clear previous logo
  display.setTextColor(WHITE); //without this no display
  display.print("Hello World!");//your TEXT here
  display.display();            //to shows or update your TEXT
}

void loop() {

 }

But I get this on the display. OLED

enter image description here

Any idea what I could be missing?

Thanks !

9
  • Do you have the product link of your display?
    – Fahad
    Oct 18, 2021 at 8:37
  • I had this display laying around for a while, unfortunately I can't find the product link.
    – zanga
    Oct 18, 2021 at 8:44
  • Is the driver IC SSD1306? Can you see that at the back of the display?
    – Fahad
    Oct 18, 2021 at 8:48
  • Not sure where can I see that, I added a picture with the back.
    – zanga
    Oct 18, 2021 at 8:57
  • 3
    0x7A is 0x3C << 1 which is correct. I2C addresses are 7 bits and the 8th bit (rightmost) is use as a R/W flag. So you shift the I2C address one to the left and then add a 1 or 0 to the left for read/write operation (I forget which way around it is). The Arduino library does that for you, so you need to provide the "unshifted" address of 0x3C.
    – Majenko
    Oct 18, 2021 at 14:07

1 Answer 1

1

Mystery solved :)

After some more reading it appears that the display driver is actually SH1106, so after using the right library I got the display working.enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.