Skip to content

Instantly share code, notes, and snippets.

@cwoodall
Created June 9, 2012 22:13
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 cwoodall/2902767 to your computer and use it in GitHub Desktop.
Save cwoodall/2902767 to your computer and use it in GitHub Desktop.
TOGGLE AN LED ON RASPBERRY PI
#!/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