0

Small script to control the brightness of the official 7" display for Raspberry

Because i wasn't able to start my display in the desired brightness automatically, i wrote a little script for dimming the display without of need to remember the whole code.

#!/bin/bash

PS3="Display-Menu:"

select lng in Dimm Dimm+ Dimm++ Display_OFF Display_ON Quit
do
    case $lng in
        "Dimm")
            echo 100 > /sys/class/backlight/rpi_backlight/brightness
            echo "$lng - Brightness set to 100";;
        "Dimm+")
            echo 80 > /sys/class/backlight/rpi_backlight/brightness
            echo "$lng - Brightness set to 80";;
        "Dimm++")
            echo 50 > /sys/class/backlight/rpi_backlight/brightness
            echo "$lng - Brightness set to 50";;
        "Display_OFF")
           echo 1 > /sys/class/backlight/rpi_backlight/bl_power
           echo "$lng - Backlight on Display is OFF";;
        "Display_ON")
           echo 0 > /sys/class/backlight/rpi_backlight/bl_power
           echo "$lng - Backlight on Display is ON";;
        "Quit")
           echo "We're done"
           break;;
        *)
           echo "Ooops";;
    esac
done

0 comments

Please sign in to leave a comment.