Answers for "bluetooth module python 3"

1

bleutooth python3 moduel

#Simple bluetooth connect
import bluetooth

target_name = "My Phone"
target_address = None

nearby_devices = bluetooth.discover_devices()

for bdaddr in nearby_devices:
    if target_name == bluetooth.lookup_name( bdaddr ):
        target_address = bdaddr
        break

if target_address is not None:
    print("found target bluetooth device with address "), target_address
else:
    print("could not find target bluetooth device nearby")
Posted by: Guest on January-19-2020

Python Answers by Framework

Browse Popular Code Answers by Language