diff options
| author | aouvrard <antoine.ouvrard@nereide.fr> | 2017-01-22 12:36:23 +0100 |
|---|---|---|
| committer | aouvrard <antoine.ouvrard@nereide.fr> | 2017-01-22 12:36:23 +0100 |
| commit | 08c1adaa40b0204f500bf95492ef999f61cd8dc3 (patch) | |
| tree | 39bc8674c01577061ff3b1b1a98c887aae1e6341 | |
| parent | 2a63bab202f5fa6e6adb3b05da1ab13cdab8889f (diff) | |
AOU:ajout du pi3
| -rw-r--r-- | README.md (renamed from README) | 0 | ||||
| -rw-r--r-- | btn_track_pi1.sh (renamed from btn_track.sh) | 0 | ||||
| -rw-r--r-- | btn_track_pi3.sh | 46 |
3 files changed, 46 insertions, 0 deletions
diff --git a/btn_track.sh b/btn_track_pi1.sh index c6a3ce5..c6a3ce5 100644 --- a/btn_track.sh +++ b/btn_track_pi1.sh diff --git a/btn_track_pi3.sh b/btn_track_pi3.sh new file mode 100644 index 0000000..e359a9d --- /dev/null +++ b/btn_track_pi3.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +#Set GPIO ID with push button +GPIO_ID="24" + +#Initialize GPIO +echo $GPIO_ID > /sys/class/gpio/export +echo in > /sys/class/gpio/gpio$GPIO_ID/direction + +#Start MPC +mpc clear +mpc load radios +mpc repeat on +mpc play + +printf "MPC started" + + +i=0 +echo "Loop check push" +while : +do + until /bin/grep 1 /sys/class/gpio/gpio$GPIO_ID/value >> /dev/null + do + /bin/sleep .1 + i=0 + done + + echo i=$i + + let i++ + if [ $i -ge 3 ] + then + printf "Shutdown by button" + sudo systemctl poweroff + break + fi + + if [ $i -ge 1 ] + then + echo "Next Track" + mpc next + /bin/sleep .5 + fi +done + |
