Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- import time as time
- from water_sched import WaterSchedule
- from light_sched import LightSchedule
- from cooling_sched import CoolingSchedule
- from lcd_sched import LCDSchedule
- # initialize schedule objects
- water = WaterSchedule()
- light = LightSchedule()
- cooling = CoolingSchedule()
- # initialize lcd
- lcd = LCDSchedule()
- def setup():
- # set up GPIO
- GPIO.setmode(GPIO.BCM)
- GPIO.setwarnings(False)
- # setup lcd
- lcd.setup()
- # setup schedules
- water.setup(lcd)
- time.sleep(2)
- light.setup(lcd)
- time.sleep(2)
- cooling.setup(lcd)
- time.sleep(2)
- def main():
- setup()
- try:
- while True:
- water.update()
- time.sleep(2)
- light.update()
- time.sleep(2)
- cooling.update()
- time.sleep(2)
- except KeyboardInterrupt:
- lcd.teardown()
- water.teardown()
- light.teardown()
- cooling.teardown()
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement