bluetooth icon indicating copy to clipboard operation
bluetooth copied to clipboard

examples: add example that makes connections to multiple peripherals

Open deadprogram opened this issue 1 year ago • 2 comments

This PR adds a new example that makes connections to multiple peripherals.

It has been tested and is known to be working on Linux and on HCI with NINAFW, as long as #317 has been merged first.

On Linux I tested with 6 simultaneous connections. It might allow more. On HCI I tested with 3 simultaneous connects. Again, more might also work.

deadprogram avatar Jan 03 '25 17:01 deadprogram

What is the main purpose of the example? Show it is possible to connect to several peripherals and subscribe to notifications from them? If so, I find all this dance with specifying device addresses unnecessary -- it just bloats the example code. Can we instead just subscribe to any HR bluetooth device we can find? Simplifies code and makes it easier to try out.

ysoldak avatar Jan 08 '25 20:01 ysoldak

I've tried to see if it works with SoftDevice (xiao-ble) and it does not seem to do.

$ tinygo flash -target xiao-ble -ldflags="-X main.Devices=84:CC:A8:2E:C1:CE,84:CC:A8:79:12:F6" -monitor ./examples/multiples/
connected to 84:CC:A8:2E:C1:CE
connected to 84:CC:A8:79:12:F6
discovering services/characteristics

It is stuck here ☝️

Two heart rate boards are Nano-RP2040, flashed like this:

tinygo flash -target=nano-rp2040 --size=short ./examples/heartrate

ysoldak avatar Jan 08 '25 21:01 ysoldak