Created
June 9, 2012 22:13
-
-
Save cwoodall/2902767 to your computer and use it in GitHub Desktop.
TOGGLE AN LED ON RASPBERRY PI
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/sh | |
## TOGGLE LED on a RASPBERRY PI | |
# Christopher Woodall and Thomas Nadovich | |
# June 9, 2012 | |
# | |
# Some reference material: http://elinux.org/RPi_Low-level_peripherals | |
# Done using the special made image of Debian Squeeze for the Raspberry Pi | |
# MUST BE ROOT: | |
# precede with `su -` if you trust me | |
echo "25" > /sys/class/gpio/export | |
echo "out" > /sys/class/gpio/gpio25/direction | |
OUTPUT="0" | |
while [ 1 ]; do | |
echo "$OUTPUT" > /sys/class/gpio/gpio25/value | |
if [ "$OUTPUT" -eq "0" ]; then | |
echo "meow" | |
let OUTPUT="1" | |
else | |
let OUTPUT="0" | |
fi | |
sleep .5 | |
done | |
# follow with: | |
# echo "25" > /sys/class/gpio/unexport |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment