Change luminosity or brightness

Description

Hello everyone, how can I change the luminosity or brightness of the screen with a slider

What MCU/Processor/Board and compiler are you using?

PC_Simulator

What do you want to achieve?

change the luminosity or brightness of the screen with a slider

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

You’d want to get the slider’s value and then adjust the brightness using whatever method is appropriate to your platform. LittlevGL does not have any built-in feature for manipulating screen brightness.

Ok, Thanks))

As @embeddedt said, you want to control the physical screen brightness, usually using a PWM input to the screen, usually designated “LITE” or something like that.
Roughly how I have done it successfully in my ESP32 projects.

#define BACKLIGHT_CHANNEL 0
#define BACKLIGHT_FREQUENCY 12000
#define BACKLIGHT_RESOLUTION_BITS 8
#define TFT_LITE 33
pinMode(TFT_LITE, OUTPUT);
ledcSetup(BACKLIGHT_CHANNEL, BACKLIGHT_FREQUENCY, BACKLIGHT_RESOLUTION_BITS);
float percent = 0.75;
int dutyCycle = (int) round(255 * percent);
ledcWrite(BACKLIGHT_CHANNEL, dutyCycle);

Good luck!

1 Like

Thank you, there will be time, I will definitely test))))