This commit is contained in:
Batuhan Berk Başoğlu 2021-04-07 20:16:03 -04:00
commit c57bdef04a

View file

@ -170,6 +170,8 @@ if __name__=="__main__":
alarmSignal = signals.child(1).child("alarm").get().val() alarmSignal = signals.child(1).child("alarm").get().val()
signals = database.child("signal") signals = database.child("signal")
cameraSignal = signals.child(1).child("camera").get().val() 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 # get distance data from distance sensor
dist = car.distance() dist = car.distance()
@ -189,9 +191,9 @@ if __name__=="__main__":
car.stop_alarm() car.stop_alarm()
# Turn on remote camera if get sensor signal # 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() car.start_camera()
elif (cameraSignal=="off" and not car.cameraOff): elif ((cameraSignal=="off" and not car.cameraOff) or powerSignal =="on"):
car.stop_camera() car.stop_camera()
# Take a picture of someone or some thing try to get close to the vehicle # Take a picture of someone or some thing try to get close to the vehicle