Scan by name and then connect to multiple devices

I need to scan the BLE devices by name available and then connect to the desired ones. My device is only advertising address and its name.
I am using ArduinoBLE.h library. Using scanForName("mydevice1") function, it only looks for and connects to that specific device.

But I want to connect to all devices that start with name mydevice. How can I do this?

You can use the ArduinoBLE function scan(). Then you go trough all the devices that you find and pick the ones with your name pattern.

Have a look at the following example:

File -> Examples -> ArduinoBLE -> Central -> Scan

Hey Klaus,

Thanks for the tip. I got it working. I am looking for a substring in the name to match and then connect to it.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.