Important: Before you run this example, make sure to program the SoftDevice .
The BLE Multi-link Central example application shows how one central can be connected to several peripherals simultaneously. We have use two or more Experimental: BLE Blinky Application as peripherals.
When the Central is scanning for peripherals, LED 1 is on. If it is in one or more connections, LED 2 turns on. (If no more connections can be established LED 1 turns off.) Experimental: BLE Blinky Application Peripherals that connect to the Central will be able to control the Central's LED 3 using Button 1. Similarly, pressing button 1 on the Central will control the LEDs on all the connected Peripherals.
The central application uses the LED Button Service Client . For each link it must allocate an instance of this service. The central application will connect to any peer that has the device name "Nordic_Blinky".
Setup
BLE Multi-link Central: You can find the source code and the project file of the example in the following folder:
<InstallFolder>\examples\ble_central\ble_app_multilink_central
BLE Multi-link Peripheral: You can find the source code and the project file of the example in the following folder:
<InstallFolder>\examples\ble_peripheral\ble_app_blinky
The BLE Multi-link Example requires at least three boards to verify that more than one link is active. The central device can have a maximum of 8 concurrent connections to peripheral devices.
LED assignments
- LED 1: On when scanning for peripherals. Off when not scanning, which means that the maximum of concurrent links has been reached.
- LED 2: On while in connection with one or more peripherals.
- LED 3: During connection, this LED can be toggled by the connected Experimental: BLE Blinky Application peripherals using Button 1 on one of the connected peripherals.
Button assignments
- Button 1: Toggle LED 3 on all connected peripherals.
Testing
Test the BLE Multi-link Example application by performing the following steps:
- Compile and program the peripheral application ( Experimental: BLE Blinky Application ) on two boards. Observe that LED 1 is on, which indicates that the boards are advertising and waiting for a central device to connect.
- Compile and program the central application onto a third board. Observe that LED 1 is on, which indicates that the central device is scanning and attempting to connect to the peripherals (more precisely, to any device with the device name "Nordic_Blinky"). The device will continue to scan until it has reached the maximum number of 8 connections.
- Observe that LED 2 is turned on, which indicates that the central is in connection with one or more peripherals.
- Press Button 1 on the Central board. Observe that this button press toggles LED 3 on all connected peripherals.
- On each of the peripherals, pressing Button 1 will toggle LED 3 on the Central device.
- Disconnect the devices, for example by pressing the Reset Button on the Central board. Observe that the boards automatically reconnect and that pressing Button 1 on the Central board toggles LED 3 on all connected peripherals. Also, pressing Button 1 on one of the peripherals will toggle LED 3 on the Central device.