Created
July 2, 2019 05:08
-
-
Save worldwise001/0983772ef6ea2eee7419db8462e342f9 to your computer and use it in GitHub Desktop.
simple bash script to turn printer on
This file contains hidden or 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 | |
PIN="26" | |
if [ ! -d "/sys/class/gpio/gpio$PIN" ]; then | |
echo $PIN > /sys/class/gpio/export; | |
fi | |
if [ "`cat /sys/class/gpio/gpio$PIN/direction`" != "out" ]; then | |
echo out > /sys/class/gpio/gpio$PIN/direction; | |
fi | |
case $1 in | |
on) | |
echo "Turning printer on"; | |
echo 1 > /sys/class/gpio/gpio$PIN/value; | |
;; | |
off) | |
echo "Turning printer off"; | |
echo 0 > /sys/class/gpio/gpio$PIN/value; | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment