-
-
Save sh4un/f193bec3791f4c639dfa02559ae9f8fa to your computer and use it in GitHub Desktop.
Script to Change the Backlight brightness on the Official Raspberry Pi 7" display.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
level=$1 | |
#echo "level given is $level" | |
if [ $# != 1 ]; then | |
echo "USAGE: $0 brightness_level (0 to 255)" | |
exit 1 | |
fi | |
if [[ $level -ge 0 && $level -le 255 ]]; then | |
#echo "level given is $level" | |
echo $level > /sys/class/backlight/rpi_backlight/brightness | |
echo "Screen brightness set to $level." | |
exit 0 | |
else | |
echo "Brightness level $level is out of range! (0 to 255 only)" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment