Skip to content

Instantly share code, notes, and snippets.

@lrvick
Created August 16, 2012 10:24
Show Gist options
  • Save lrvick/3369097 to your computer and use it in GitHub Desktop.
Save lrvick/3369097 to your computer and use it in GitHub Desktop.
Send 1hz pulse to all Raspberry Pi GPIO pins for testing, using bash
#!/bin/bash
pins=( 4 25 24 23 22 21 18 17 )
for pin in "${pins[@]}"; do
echo $pin > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio${pin}/direction
sleep 0.1
done
while true; do
for pin in "${pins[@]}"; do
echo "1" > /sys/class/gpio/gpio${pin}/value #LED on
done
sleep 1 # sleep 1 sec
for pin in "${pins[@]}"; do
echo "0" > /sys/class/gpio/gpio${pin}/value #LED on
done
sleep 1 # sleep 1 sec
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment