SHARE
TWEET

Untitled

a guest Aug 12th, 2016 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import RPi.GPIO as GPIO
  2. import time as time
  3.  
  4. from water_sched import WaterSchedule
  5. from light_sched import LightSchedule
  6. from cooling_sched import CoolingSchedule
  7. from lcd_sched import LCDSchedule
  8.  
  9. # initialize schedule objects
  10. water = WaterSchedule()
  11. light = LightSchedule()
  12. cooling = CoolingSchedule()
  13.  
  14. # initialize lcd
  15. lcd = LCDSchedule()
  16.  
  17. def setup():
  18.     # set up GPIO
  19.     GPIO.setmode(GPIO.BCM)
  20.     GPIO.setwarnings(False)
  21.  
  22.     # setup lcd
  23.     lcd.setup()
  24.    
  25.     # setup schedules
  26.     water.setup(lcd)
  27.     time.sleep(2)
  28.  
  29.     light.setup(lcd)
  30.     time.sleep(2)
  31.  
  32.     cooling.setup(lcd)
  33.     time.sleep(2)
  34.  
  35. def main():
  36.     setup()
  37.  
  38.     try:
  39.  
  40.         while True:
  41.             water.update()
  42.             time.sleep(2)
  43.  
  44.             light.update()
  45.             time.sleep(2)
  46.  
  47.             cooling.update()
  48.             time.sleep(2)
  49.  
  50.     except KeyboardInterrupt:
  51.         lcd.teardown()
  52.         water.teardown()
  53.         light.teardown()
  54.         cooling.teardown()
  55.  
  56. if __name__ == "__main__":
  57.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top