From a2996f7809159853af2307c2987e0c4858542c0c Mon Sep 17 00:00:00 2001 From: rav4s Date: Thu, 17 Dec 2020 16:56:18 -0600 Subject: [PATCH] debugging --- garage_door_script.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/garage_door_script.py b/garage_door_script.py index cbd7d75..05f09b2 100644 --- a/garage_door_script.py +++ b/garage_door_script.py @@ -31,6 +31,10 @@ def index(): pulse_end_time = time.time() #Record the time the waves traveled back to the sensor pulse_duration = pulse_end_time - pulse_start_time #Calculate how long it took for the round trip of the waves distance = round(pulse_duration * 17150, 2) #Convert the time it took to centimeters and round to 2 decimals + if distance >= 80: #Check if the distance is less than 80cm (This will depend on the garage) + return 'The garage is closed.' + else: + return 'The garage is open.' if __name__ == '__main__': app.run(host='0.0.0.0') #Run the webserver