Created
November 1, 2015 17:23
-
-
Save ericoporto/44833e55d7c2af88e3bd to your computer and use it in GitHub Desktop.
Turn a pin from Raspberry on at a time for a duration period.
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 | |
# call using ./pinsched <time> <duration> <pin number> | |
# example: ./pinsched 14:00 2hours 5 | |
timeat="$1" | |
duration="$2" | |
ledpim="$3" | |
endtime=`date +%H:%M -d " $timeat today + $duration"` | |
gpio -g mode $ledpin out | |
echo "gpio -g write $ledpin 1" | at $timeat | |
echo "gpio -g write $ledpin 0" | at $endtime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment