Hi,
I'm working on the following setup:
- 2 BLE peripherals that advertise one service and two characteristics. One READ/WRITE characteristic to turn something on/off, let's say a LED. One READ/NOTIFY characteristic to send sensor data to the central. Let's say a FSR / pressure sensor.
- 1 BLE central that receives the sensor data of the two peripherals and determines which peripheral should turn the LED on/off. The central is attached to a computer so you can configure certain parameters and collect log data.
The system will be used during walking. The average steps per minute is 100 steps. So timing is quite important. Let's say the sensor data changes + notifies every 50ms. Turning the LED on/off will happen once every 500ms or so.
I'm using the ArduinoBLE library. My question is: Can I connect the Central with 2 peripherals simultaneously? Should I use the setEventHandler() for this? Or is this impossible with the ArduinoBLE library? It looks like the central has to stop scanning before connecting to a peripheral.
Some suggest to connect, read/write and then disconnect each time. But since the sensor info is required more or less realtime (every 50ms or so) and we need to turn on/off a peripheral very fast, I worry about the latency. Battery is less important. Is there no other way?
I've also thought about connecting the peripherals directly (one peripheral, one central then). But then I can't intercept log data or easily (wireless) configure the parameters. Suggestions are welcome :).