Skip to content

Instantly share code, notes, and snippets.

@eloydegen
Created December 9, 2016 14:11
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 eloydegen/d001d3138ca2a6a9c3e99e6cde4b488c to your computer and use it in GitHub Desktop.
Save eloydegen/d001d3138ca2a6a9c3e99e6cde4b488c to your computer and use it in GitHub Desktop.
Check all GPIO pins
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Run this script as root"
exit
fi
cd /sys/class/gpio
touch export
for i in {1..27}
do
echo "Exorting pin $i"
echo $i >> export
sleep 0.2
echo "Set direction out of pin $i"
echo "out" > gpio${i}/direction
sleep 0.2
echo "Set value to 1 of pin $i"
echo "1" > gpio${i}/value
sleep 2.0
echo "Unexport pin $i"
echo $i > unexport
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment