Update garage.py

This commit is contained in:
2020-08-06 12:26:03 +00:00
parent 94a1c7b621
commit 2dd174d73b
+5 -5
View File
@@ -31,7 +31,7 @@ def motor_button(channel):
logging.info("trigger motor")
GPIO.output(PIN_MOTOR, GPIO.LOW)
GPIO.output(PIN_LED, GPIO.HIGH)
time.sleep(0.8)
time.sleep(0.4)
GPIO.output(PIN_MOTOR, GPIO.HIGH)
GPIO.output(PIN_LED, GPIO.LOW)
@@ -39,12 +39,12 @@ def remote_button(channel):
logging.info("trigger remote")
GPIO.output(PIN_REMOTE, GPIO.HIGH)
GPIO.output(PIN_LED, GPIO.HIGH)
time.sleep(0.8)
time.sleep(0.4)
GPIO.output(PIN_REMOTE, GPIO.LOW)
GPIO.output(PIN_LED, GPIO.LOW)
GPIO.add_event_detect(PIN_MOTOR_BUTTON, GPIO.FALLING, callback=motor_button, bouncetime=200)
GPIO.add_event_detect(PIN_REMOTE_BUTTON, GPIO.FALLING, callback=remote_button, bouncetime=200)
GPIO.add_event_detect(PIN_MOTOR_BUTTON, GPIO.RISING, callback=motor_button, bouncetime=250)
GPIO.add_event_detect(PIN_REMOTE_BUTTON, GPIO.RISING, callback=remote_button, bouncetime=250)
GPIO.output(PIN_MOTOR, GPIO.HIGH)
GPIO.output(PIN_REMOTE, GPIO.LOW)
@@ -77,4 +77,4 @@ class GarageService(object):
cherrypy.quickstart(GarageService())
logging.info('Shutdown')
logging.info('Reset GPIO configuration and close')
GPIO.cleanup()
GPIO.cleanup()