ble_simpletest.py
1 """ 2 This example scans for any BLE advertisements and prints one advertisement and one scan response 3 from every device found. 4 """ 5 6 from adafruit_ble import BLERadio 7 8 ble = BLERadio() 9 print("scanning") 10 found = set() 11 scan_responses = set() 12 for advertisement in ble.start_scan(): 13 addr = advertisement.address 14 if advertisement.scan_response and addr not in scan_responses: 15 scan_responses.add(addr) 16 elif not advertisement.scan_response and addr not in found: 17 found.add(addr) 18 else: 19 continue 20 print(addr, advertisement) 21 print("\t" + repr(advertisement)) 22 print() 23 24 print("scan done")