Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # cat pump.sh
- #!/bin/bash
- #pumps are timer based, and run the first 15 minutes of every hour. We
- #might do a 2 pin dip switch at some point to adjust this, but this is
- #not yet supported. EG:
- #00 = 0
- #01 = 15
- #10 = 30
- #11 = 45
- #REMEMBER NOT YET SUPPORTED
- ########################################
- #Changelog:
- #5/10/12 initial version (runs in crontab)
- #first we check if the pin exists
- if ! [ -d /sys/devices/virtual/gpio/gpio7 ];
- #echo "GPIO EXISTS"
- then
- #echo "CREATING GPIO"
- echo "7" > /sys/class/gpio/export
- fi
- #/sys/devices/virtual/gpio/gpio7/
- #we check the pin direction
- DIRECTION=`cat /sys/devices/virtual/gpio/gpio7/direction`
- #echo ${DIRECTION}
- if [ "${DIRECTION}" = "in" ]; then
- #echo "SETTING IN TO OUT"
- echo "out" > /sys/devices/virtual/gpio/gpio7/direction
- fi
- #turn on pump
- #echo "TURNING ON PUMP"
- echo "1" > /sys/devices/virtual/gpio/gpio7/value
- sleep 900
- #echo "TURNING OFF PUMP"
- echo "0" > /sys/devices/virtual/gpio/gpio7/value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement