Advertisement
Guest User

Untitled

a guest
Jun 14th, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. # cat pump.sh
  2. #!/bin/bash
  3. #pumps are timer based, and run the first 15 minutes of every hour. We
  4. #might do a 2 pin dip switch at some point to adjust this, but this is
  5. #not yet supported. EG:
  6. #00 = 0
  7. #01 = 15
  8. #10 = 30
  9. #11 = 45
  10. #REMEMBER NOT YET SUPPORTED
  11. ########################################
  12. #Changelog:
  13. #5/10/12 initial version (runs in crontab)
  14.  
  15. #first we check if the pin exists
  16. if ! [ -d /sys/devices/virtual/gpio/gpio7 ];
  17. #echo "GPIO EXISTS"
  18. then
  19. #echo "CREATING GPIO"
  20. echo "7" > /sys/class/gpio/export
  21. fi
  22.  
  23.  
  24. #/sys/devices/virtual/gpio/gpio7/
  25. #we check the pin direction
  26. DIRECTION=`cat /sys/devices/virtual/gpio/gpio7/direction`
  27. #echo ${DIRECTION}
  28. if [ "${DIRECTION}" = "in" ]; then
  29. #echo "SETTING IN TO OUT"
  30. echo "out" > /sys/devices/virtual/gpio/gpio7/direction
  31. fi
  32.  
  33. #turn on pump
  34. #echo "TURNING ON PUMP"
  35. echo "1" > /sys/devices/virtual/gpio/gpio7/value
  36. sleep 900
  37. #echo "TURNING OFF PUMP"
  38. echo "0" > /sys/devices/virtual/gpio/gpio7/value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement