Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- # import RPi.GPIO as GPIO
- MOTOR_TIMEOUT = 3
- target_temp = 23
- local_temp = 20
- operation_motor_start = 0
- motor_running = False
- def damper_motor_driver():
- global motor_running
- global operation_motor_start
- if motor_running == True:
- current_motor_time = time.time()
- if current_motor_time - operation_motor_start > MOTOR_TIMEOUT:
- motor_running = False
- operation_motor_start = 0
- #GPIO.output(_MotorR,GPIO.LOW)
- #GPIO.output(_MotorL,GPIO.LOW)
- print("GOOD The time is ending")
- def open_damper():
- global operation_motor_start
- global motor_running
- motor_running = True
- operation_motor_start = time.time()
- #GPIO.output(_MotorR,GPIO.LOW)
- #GPIO.output(_MotorL,GPIO.HIGH)
- def close_damper():
- global operation_motor_start
- global motor_running
- motor_running = True
- operation_motor_start = time.time()
- #GPIO.output(_MotorR,GPIO.HIGH)
- #GPIO.output(_MotorL,GPIO.LOW)
- while True:
- damper_motor_driver()
- if target_temp > local_temp:
- close_damper()
- local_temp = 25
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement