Last active
November 10, 2016 22:35
-
-
Save tuxmartin/523aa19336c630c354a6 to your computer and use it in GitHub Desktop.
Angee GPIO factory reset
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 | |
export PATH=$PATH:/usr/local/bin | |
# Set up GPIO 3 and set to input | |
echo "3" > /sys/class/gpio/export | |
echo "in" > /sys/class/gpio/gpio3/direction | |
# Read from input | |
cat /sys/class/gpio/gpio3/value | |
while true; do | |
sleep 1 | |
STATUS=`cat /sys/class/gpio/gpio3/value` | |
if [ "$STATUS" == "0" ] ; then | |
mosquitto_pub -h localhost -t 'respawner/factory_reset' -m "x" | |
fi | |
done | |
################################# | |
# https://github.com/fivdi/onoff/wiki/Enabling-Pullup-and-Pulldown-Resistors-on-The-Raspberry-Pi | |
# http://www.element14.com/community/docs/DOC-73950/l/raspberry-pi-2-model-b-gpio-40-pin-block-pinout | |
# GPIO3 (05,06) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment