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.