I would like to create a project where a central Nano BLE device reads information from several other peripheral Nano BLE devices. For example, 3 peripheral Nanos gather orientation data from their IMU sensors and send those analog values to the central device.
My first question would be: is it achievable to connect more than 6 Nano devices together at the moment?
The above mentioned project would be my final goal but first I would like to achieve something simpler.
What I would like to do is to read an analog integer value with one Nano device from a potentiometer, store the data in a characteristic and use another Nano to read the data. Then, I would like to be able to vary the brightness of an LED with that Nano. So, basically tuning the potentiometer at one Nano board which would control the brightness of an LED at the other Nano board.
I saw some examples like these:
both written by Klaus_K which shares the accelerometer data via BLE which can be read by a Bluetooth scanning App, but I am not sure how to enable another Nano board to read it.
I’m pretty new to this, I’ve tried experimenting with the code and checked out the ArduinoBLE library documentation but haven’t really got anywhere.
I wonder if anyone managed to get something similar done and would share an example with me?
In the examples with the ArduinoBLE library, there is a sketch for a peripheral device called "BatteryMonitor.ino" which sends an analog value reading in a characteristic.
The example sketch "PeripheralExplorer.ino" for central devices shows how to read the value in a characteristic sent from the peripheral.
Those two example sketches should get you started.
Controlling the brightness of an led with that value is a task unrelated to bluetooth.
Can your share a bit more about the motivation for your project? That will allow us to get you some better answers. Right now, your post is a bit confusing. It is unclear
what those devices are (are they all the same)?
how many (3 or 6)?
what is the mode of input (IMU, potentiometer)?
what do you want to control an LED for lighting?
how often they need to connect and for how long?
how do they know who needs to talk to who?
That is not how BLE works. From an applications point of view peripherals do not send data to a central device. Central devices read/write data on peripherals. At the end it may look the same, but you need to understand what is going on to program everything correctly.
This depends on a lot of things. Back to my questions at the beginning.
The issue with central sketches is they are fundamentally more flexible and therefore not easy to write examples for. A peripheral makes all the rules and can be written in a standard way. You setup GATT (services and characteristics) and update the data or use new data written. A central device needs to find the right peripheral device and handle a lot of uncertain situations e.g., is the service/characteristic available, can it be read/written/subscribed to, ...
All the fundamentals are in the example cattledog pointed you to.
If you post your sketch you have so far, we can provide you some feedback.