From fa4f1307931d8977b68482cd9f50740c9b9d2f70 Mon Sep 17 00:00:00 2001 From: LEYAO LI Date: Sun, 4 Apr 2021 16:58:29 -0400 Subject: [PATCH] Motor start condition bug fix --- final_demo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/final_demo.py b/final_demo.py index 082aa9789..730a4e101 100644 --- a/final_demo.py +++ b/final_demo.py @@ -173,10 +173,10 @@ if __name__=="__main__": # get distance data from distance sensor dist = car.distance() - print ("Measured Distance = %.1f cm" % dist) + #print ("Measured Distance = %.1f cm" % dist) # Turn on motor if get sensor signal - if ((motorSignal=="on" or dist>15) and car.motorStop): + if ((motorSignal=="on" and dist>15) and car.motorStop): car.start_motor() elif ((motorSignal=="off" or dist<=10) and not car.motorStop): # Stop the motor if the vehicle is too close to the item at front as well