Browse Source

debugging

pull/1/head
Ravi Shah 5 years ago
parent
commit
a2996f7809
  1. 4
      garage_door_script.py

4
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
Loading…
Cancel
Save