prototype.py 729 B

12345678910111213141516171819202122232425262728
  1. import bluetooth
  2. def scan():
  3. """
  4. bluetooth detection is probabalistic, discover_devices() can fail to detect devices
  5. that are in range
  6. """
  7. nearby_devices = bluetooth.discover_devices()
  8. return nearby_devices
  9. # use address of the Radon-Eye RD200 device we purchased off Amazon in 2021 October
  10. target_address = "CF:CD:27:79:55:6B"
  11. nearby_devices = scan()
  12. # print a message about finding the device, or terminate
  13. searching = True
  14. for i in range(3):
  15. if target_address in nearby_devices:
  16. print("found ", target_address)
  17. searching = not searching
  18. break
  19. if searching:
  20. print(target_address, " not found")
  21. quit()
  22. # at this point I found out that bluez does not support BLE