From 6893c6a33832ea86fcab53f8f6155e932a5d544f Mon Sep 17 00:00:00 2001 From: LEYAO LI Date: Wed, 7 Apr 2021 18:29:30 -0400 Subject: [PATCH] Debug for camera been turned on at the same time by different function --- final_demo.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/final_demo.py b/final_demo.py index 730a4e101..9eb78625f 100644 --- a/final_demo.py +++ b/final_demo.py @@ -170,6 +170,8 @@ if __name__=="__main__": alarmSignal = signals.child(1).child("alarm").get().val() signals = database.child("signal") cameraSignal = signals.child(1).child("camera").get().val() + signals = database.child("signal") + powerSignal = signals.child(1).child("power").get().val() # get distance data from distance sensor dist = car.distance() @@ -189,9 +191,9 @@ if __name__=="__main__": car.stop_alarm() # Turn on remote camera if get sensor signal - if (cameraSignal=="on" and car.cameraOff): + if (cameraSignal=="on" and car.cameraOff and powerSignal=="off"): car.start_camera() - elif (cameraSignal=="off" and not car.cameraOff): + elif ((cameraSignal=="off" and not car.cameraOff) or powerSignal =="on"): car.stop_camera() # Take a picture of someone or some thing try to get close to the vehicle