Hi,
My project is in Javascript and I use the ant-plus-next library to attach multiple sensor (in theory up to 8 sensors) using a USBStick2.
To attach in safe mode all the sensor I used the same logic written in the official github repo:
antplusnextExample.
Essentially I first attach with wildcard mode (
sensor.attach(0, 0);) and only when I get the real deviceID i detach it and start to attach it at the specificID at the same channel (
sensor.attach(0,deviceID)
This works really well for many sensors.
The problem happens with a particular heart rate sensor: the POLAR H9 (and maybe others that I hadn't tested yet!). With this sensor my code stops on the specific attach and never returns.
The only way that I found to make it work is to attach it in wildcard mode, then, when I get the specific sensor ID, detach it, and finally create a NEW object
HeartRateSensor and attach it with the specific ID and the next channel. So in this case, the POLAR H9 make me waste 1 channel (the first used for wildcard attach, the following for the specific attach).
You will find attached the code that I use now to handle the attach logic.
I really want to find another way, to occupy only one channel!
Thanks in advance