12345678910111213141516171819202122232425262728 |
- import bluetooth
- def scan():
- """
- bluetooth detection is probabalistic, discover_devices() can fail to detect devices
- that are in range
- """
- nearby_devices = bluetooth.discover_devices()
- return nearby_devices
- # use address of the Radon-Eye RD200 device we purchased off Amazon in 2021 October
- target_address = "CF:CD:27:79:55:6B"
- nearby_devices = scan()
- # print a message about finding the device, or terminate
- searching = True
- for i in range(3):
- if target_address in nearby_devices:
- print("found ", target_address)
- searching = not searching
- break
- if searching:
- print(target_address, " not found")
- quit()
- # at this point I found out that bluez does not support BLE
|