Oled doesn't work

I'm making a code so that the 128x64 oled screen shows that I'm sending a message. It's a simple code. But it doesn't work. Compilng and uploading is always success, but it didn't print in oled screen. Somtimes it works, but it stops after repeating it once or twice. I used a replica of nano. I'm not sure what the problem is. Help me!

#include <Adafruit_SSD1306.h>
#include <splash.h>
#include "U8glib.h"

U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);
int dotcount=0;
void setup() {

}

void loop() {
  u8g.firstPage();
  do {
    u8g.setFont(u8g_font_helvB08);
    u8g.setPrintPos(0, 20);
    u8g.print("Sending");

      for (int i = 0; i < dotCount; i++) {
        u8g.print("."); 
      }
	delay(200);

      if (dotCount == 4) {
        dotCount = 0;
        u8g.firstPage();
        delay(200);
      }
    }while (u8g.nextPage());
      dotCount++;                                   
}

Two suggestions. It is probably a hardware problem. Post A schematic as you have wired it and include links to technical information on each of the hardware items. Second run the I2C scanner for a while and let us know the results.

2 Likes

I don't see any code in the void setup{}. Maybe not required with the libraries you are using.

My suggestion is to run one of the example sketches from your library.

1 Like


Schematic is as follows, but instead of using UNO, nano was used.
Oled I used is gme-12864. When running the I2C scanner, the result was 0x3C.

It works very well when I run an example in my library. :smiling_face_with_tear:

take a example and remove parts which you dont need and add parts which you need. then u will be sure it will work

Sorry, I forgot that the nano was that way.
I was thinking about a different board.
Sorry.

i think on nano sda and sdl are those only

There are versions of those OLEDs for 5V logic Arduino use and another for 3.3V logic Arduino use.

Which one do you have ?

Absolute rubbish....

https://www.electronicwings.com/arduino/arduino-i2c

1 Like

I solved by adding this code

Wire.begin(); 
Wire.setClock(400000);

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