Created
December 9, 2016 14:11
-
-
Save eloydegen/d001d3138ca2a6a9c3e99e6cde4b488c to your computer and use it in GitHub Desktop.
Check all GPIO pins
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/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