1

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?

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
  • 1
    sadly 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 8 '18 at 5: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 8 '18 at 13:47
  • 1
    If 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 8 '18 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.