Code Block Test

Tiempo de lectura: < 1 minuto

You have a function today that allows to reduce the brightness of OLED screen SSD1306 connected to our Arduino.

Palmeras noche - Pexels

We added this code using the Adafruit library:

 adafruit/Adafruit SSD1306@^2.5.7 adafruit/Adafruit GFX Library@^1.11.9

We will create a function:

void OledDisplay::brightness(uint8_t level) { display.ssd1306_command(SSD1306_SETCONTRAST); display.ssd1306_command(level); }

We can add values in the following range: 0-255

For level = 255, all pixels are turned on → maximum brightness.

For level = 127, approximately half will be lit → medium brightness.

For level = 20, few points will be lit → very dim.

Leave a Comment