I've been working on a project which would requirethe use of multiple peripherials to recieve data, convert it to a byte, and send it over bluetooth using Arduino 33 Nano Senses. I have successfully connected one central to one peripherial to read and write to the characteristics. I now need to add two more peripherials to the central to read the characteristics however, I'm not sure how to proceed in adding even a second peripherial to a central device. I've attached copies of my code for reference to what I currently have. Any guidance on how to add a second peripherial to the central devices code would be greatly appreciated. Thanks.
Does the central board need to be connected to the various peripheries simultaneously or can it go through each periphery in order and act upon the data as it goes/once it is done? The latter option is doable as you can just connect, collect, and disconnect in sequence.
Just run trough the peripherals one by one. Use the BLE.scanForUuid( uuid ) functions with different UUIDs. BLE was designed to be a connect, get data, disconnect interaction. This will reduce the power the peripherals will need because they do not need to maintain a connection for long.
Tip: use a define to setup the UUID. That way you can easily used 128 bit random UUID as specified by the Bluetooth org. e.g.
There are generators online or you can use a litte scripts to create random numbers.
If you place them in a header file you can share them easier between sketches.
You can also check the Bluetooth org web page for predefined UUID's. That way your sensor will become more universal and might work with other stuff together without you changing your code.