ThingPulse / esp8266-oled-ssd1306

Driver for the SSD1306 and SH1106 based 128x64, 128x32, 64x48 pixel OLED display running on ESP8266/ESP32
https://thingpulse.com
Other
2.01k stars 638 forks source link

Fade in/out display #351

Closed thijstriemstra closed 2 years ago

thijstriemstra commented 3 years ago

How can I fade in/out the display?

illosan commented 2 years ago

Fadein:

  for (int i = 0; i < 256; i++) {
    d1306.setBrightness(i);
    d1306.display();
    delay(2);
  }

Fadeout:

  for (int i = 255; i >= 0; i--) {
    d1306.setBrightness(i);
    d1306.display();
    delay(4);
  }
thijstriemstra commented 2 years ago

thanks!