Last active
May 17, 2017 13:30
-
-
Save h6y3/8a4c62441ce7a39b4a8031fef171db4b to your computer and use it in GitHub Desktop.
Ruby script to turn Raspberry Pi 7" LCD on or off
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
#!/usr/bin/ruby | |
# Example usage: ./rpi-lcd.sh --power=on | |
args = Hash[ ARGV.join(' ').scan(/--?([^=\s]+)(?:=(\S+))?/) ] | |
power = args["power"] | |
if power == "on" | |
%x(sudo bash -c "echo 0 > /sys/class/backlight/rpi_backlight/bl_power") | |
elsif power == "off" | |
%x(sudo bash -c "echo 1 > /sys/class/backlight/rpi_backlight/bl_power") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment