olikraus / u8glib

Arduino Monochrom Graphics Library for LCDs and OLEDs
https://github.com/olikraus/u8glib/wiki
Other
1.24k stars 313 forks source link

OLED flicker #531

Closed patrickwasp closed 5 months ago

patrickwasp commented 5 months ago

Hi,

I'm encountering a strange issue with my Adafruit 128x64 monochrome OLED screen. After writing to it once during the setup, I've noticed it flickers, even though I'm not continuously updating the content. Has anyone experienced something similar or knows what might be causing this?

It looks solid when looking at it with my eyes but it still causes discomfort. It's subtle flickering, something like I've seen with low-frequency PWM in the past.

https://github.com/olikraus/u8glib/assets/70671760/53478162-81d2-4a9c-a054-62886fe50371

#include <U8g2lib.h>
U8G2_SH1107_64X128_F_HW_I2C u8g2(U8G2_R1);

void setup(void) {
  u8g2.begin();
  u8g2.setFont(u8g2_font_6x10_mr);

  u8g2.clearBuffer();                  // clear the internal memory
  u8g2.setFont(u8g2_font_6x10_mr);  // choose a suitable font
  u8g2.drawStr(0, 10, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  u8g2.drawStr(0, 20, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  u8g2.drawStr(0, 30, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  u8g2.drawStr(0, 40, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  u8g2.drawStr(0, 50, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  u8g2.drawStr(0, 60, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  u8g2.drawStr(0, 70, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  u8g2.sendBuffer();  // transfer internal memory to the display
}

void loop(void) {}

A similar sketch using Adafruit libraries refreshes the screen faster, fast enough for me not to be bothered by this.

#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>

voide setup() {
  display.begin(0x3C, true);
  display.display();
  display.clearDisplay();
  display.display();
  display.setRotation(1);
  display.setTextSize(1);
  display.setTextColor(SH110X_WHITE);
  display.setCursor(0,0);
  display.print("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  display.display(); 
}

void loop(void){}