BLE devices work with a "Peripheral/Central" style where one device is in Peripheral mode and broadcasts data out to any Central device(s) that is/are listening out for it.
This is only true for the advertisement data. For all other data, the GATT protocol is used, and data must be read by the central device when it is connected to the peripheral. Otherwise, the data is not sent (this is part of the low energy in BLE, data is only sent when requested.).
Therefore, first of all, your ergometer has to be a BLE ergometer and you will need your Nano 33 (in Central mode) to know what to listen out for.
This is likely the case (unless it is ANT+). I do not believe there are Bluetooth Classic cycling sensors out there. They would not work for too long on a coin cell.
Then, secondly, your Nano will have to switch to Peripheral mode (which I have never tested) to then connect to the PC. This would also mean that there would be a delay between disconnecting from the ergometer and then connecting to the PC, so even if it did work, there would be a lag in the stream of data as it switches and connects back and forth.
This would not work in this case. I suspect Armored76 wants this to work with off the shelf BLE products. When the device switches the PC central would be disconnected.
I have done a little experiment. It looks like the Arduino Nano 33 BLE can be a peripheral and a central at the same time. I have done the following.
- Nano 33 IoT with one service and characteristic blinking a LED and setting the characteristic to 0x0 and 0x1
- Nano 33 BLE with one service and characteristic reading the characteristic from the Nano 33 IoT and setting the value on its own characteristic.
- connected BLE Scanner on iOS to the Nano 33 BLE
I can see the LED blink at the same speed (200 ms ON 200 ms OFF) and the value gets updated in the app. This should be enough for cycling sensors. I suspect they do not update very often.
This will need some experimenting to get the code to do more (e.g., some power computation) and to be more robust.