Archived
1
0
This repository has been archived on 2025-04-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
garden/automatic/routine.py
2021-11-12 13:55:45 -05:00

36 lines
669 B
Python

#! env/bin/python3
import RPi.GPIO as GPIO
import time
from input import get_pin_input
if __name__ == "__main__":
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# If any error, Exit cleanly.
try:
while True:
inputs = get_pin_input()
if 6 < inputs['hour'] < 22:
GPIO.output(21,True)
else:
GPIO.output(21,False)
if inputs['minute']-30 < 0:
GPIO.output(26,True)
else:
GPIO.output(26,False)
# Cleanup on Exit.
finally:
GPIO.output(21,False)
GPIO.output(26,False)
GPIO.cleanup()