Hi. I'm using uglib for a SSD1306 128x64 OLED in my current project. Its connected to a Arduino UNO, SDA and SCL.
I noticed that the OLED suddenly stops updating the display, but the micro still runs the code. Its a bit random when it stops updating, but always before a minute or so of execution.
For debugging, I write to serial in the draw() function, and when OLED updates correctly I see from serial that draw() is run 8 times per updated. However, when the display has frozen, the draw() only run one time per update.
Test code used:
#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
int teller=0;
void draw(void) {
u8g.setFont(u8g_font_unifont);
u8g.setPrintPos(0,55);
u8g.print(teller);
Serial.print(teller);
}
void setup(void) {
Serial.begin(9600);
// assign default color value
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
u8g.setColorIndex(255); // white
}
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
u8g.setColorIndex(3); // max intensity
}
else if ( u8g.getMode() == U8G_MODE_BW ) {
u8g.setColorIndex(1); // pixel on
}
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255,255,255);
}
}
void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
// rebuild the picture after some delay
delay(1000);
teller++;
Serial.println("");
}
Example of serial output(OLED froze on 7):
11111111
22222222
33333333
44444444
55555555
66666666
77777777
8
9
10
11
12
13
14
15
Somebody experienced same thing? Could it be a issue internally in my OLED?