Im trying to make a small programm that prints Car is save when the bluetooth adress is fount. But when it doenst see any friendly bluetooth addr it should print Car been stole!.
How can I do this, now if it doenst find anything it prints nothing. If I do it with the ELSE: function it prints it for every other addres fount.
import bluetooth
def vindbluetooth():
nearby_devices = bluetooth.discover_devices(lookup_names=True)
for addr, name in nearby_devices:
count = 0
if addr == "XXXXXXXXXXX":
print(addr, name)
print("Owner Found!, Car is save!")
count = count + 1
if addr == "XXXXXXXX":
print("Owner Found!, Car is save!")
print(addr, name)
count = count + 1
if count == 0:
print("Your car is stolen!")
vindbluetooth()
Aucun commentaire:
Enregistrer un commentaire