Pushing some work on automatic mode.
This commit is contained in:
35
automatic/routine.py
Normal file
35
automatic/routine.py
Normal file
@@ -0,0 +1,35 @@
|
||||
#! 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()
|
||||
|
||||
Reference in New Issue
Block a user