I'm looking for a way to control the screen brightness from code. I saw this post but this just turns the screen on and off. How can I dim the screen before it goes to sleep instead of just turning it off and wake up the screen in code (later using I/O) by brightening it gradually?
Asked
Active
Viewed 902 times
1 Answers
0
Possible answer to your question can probably be found in the answer to this Adjusting the Brightness of the Official Touchscreen Display post. I clearly says a display brightness can be adjusted by sending a value to /sys/class/backlight/rpi_backlight/brightness as shown below.
echo n > /sys/class/backlight/rpi_backlight/brightness

user91822
- 422
- 2
- 5
-
1sadly it doesn't work on the main display but only on the touchscreen. I don't even have /sys/class/backlight/rpi_backlight on my system... – Itamar Kerbel Oct 08 '18 at 05:33
-
Sorry to hear about that. BTW, there is an answer on the link above with a simple Python script to module for controlling power and brightness of the official Raspberry Pi 7" touch display. It is for a touch display and perhaps you can download to give it a try to see if it can be used to adjust the brightness of your display. – user91822 Oct 08 '18 at 13:47
-
1If you look at the script file rpi_backlight.py you'll see right at the beginning that the PATH leads to non-other than "/sys/class/backlight/rpi_backlight/" - same thing sadly – Itamar Kerbel Oct 08 '18 at 19:32