print("\nConnected to dongle\n\n" "Welcome to the Bluetooth device Scanning example!\n\n") # Set the dongle in central role my_dongle.at_central() user_input = input("Enter:\n" '"1" Continuous scan\n' '"2" Scan for a limited time\n' '"3" Scan a target device\n') if user_input == "1": # "Continuous scan" option # Start scanning for bluetooth devices my_dongle.at_gapscan() log = [] try: while True: # Fetch response from the dongle response = my_dongle.rx_scanning_results # Iterate the response for every device found for device in response: # Add and print the device if its not already found if device not in log: print(device) log.append(device) except: my_dongle.stop_scan() exit()
'Welcome to the Bluetooth device Scanning example!\n\n') # Set the dongle in central role my_dongle.at_central() try: user_input = input('Enter:\n' '"1" Continuous scan\n' '"2" Scan for a limited time\n' '"3" Scan a target device\n') if user_input == '1': # "Continuous scan" option # Start scanning for bluetooth devices my_dongle.at_gapscan() log = [] while True: # Fetch response from the dongle response = my_dongle.rx_response # Iterate the response for every device found for device in response: # Add and print the device if its not already found if device not in log: print(device) log.append(device) elif user_input == '2': # "Scan for a limited time" option