Skip to content

Instantly share code, notes, and snippets.

@sh4un
Forked from Everlanders/backlight.sh
Created May 28, 2018 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sh4un/f193bec3791f4c639dfa02559ae9f8fa to your computer and use it in GitHub Desktop.
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.
#!/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