Skip to content

Instantly share code, notes, and snippets.

@tuxmartin
Last active November 10, 2016 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tuxmartin/523aa19336c630c354a6 to your computer and use it in GitHub Desktop.
Save tuxmartin/523aa19336c630c354a6 to your computer and use it in GitHub Desktop.
Angee GPIO factory reset
#!/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