Bluetooth: LED Button Service
This sample demonstrates how to use the LED Button Service (LBS).
Requirements
The sample supports the following development kits:
The following board variants do not have DFU capabilities:
S115:
Hardware platform
PCA
Board target
PCA10156
bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice
nRF54L15 DK (emulating nRF54L10)
PCA10156
bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice
nRF54L15 DK (emulating nRF54L05)
PCA10156
bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice
PCA10184
bm_nrf54lm20dk/nrf54lm20a/cpuapp/s115_softdevice
PCA10214
bm_nrf54ls05dk/nrf54ls05b/cpuapp/s115_softdevice
PCA10188
bm_nrf54lv10dk/nrf54lv10a/cpuapp/s115_softdevice
S145:
Hardware platform
PCA
Board target
PCA10156
bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice
nRF54L15 DK (emulating nRF54L10)
PCA10156
bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice
nRF54L15 DK (emulating nRF54L05)
PCA10156
bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice
PCA10184
bm_nrf54lm20dk/nrf54lm20a/cpuapp/s145_softdevice
PCA10214
bm_nrf54ls05dk/nrf54ls05b/cpuapp/s145_softdevice
PCA10188
bm_nrf54lv10dk/nrf54lv10a/cpuapp/s145_softdevice
The following board variants have DFU capabilities:
S115:
Hardware platform
PCA
Board target
PCA10156
bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice/mcuboot
nRF54L15 DK (emulating nRF54L10)
PCA10156
bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice/mcuboot
nRF54L15 DK (emulating nRF54L05)
PCA10156
bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice/mcuboot
PCA10184
bm_nrf54lm20dk/nrf54lm20a/cpuapp/s115_softdevice/mcuboot
PCA10214
bm_nrf54ls05dk/nrf54ls05b/cpuapp/s115_softdevice/mcuboot
PCA10188
bm_nrf54lv10dk/nrf54lv10a/cpuapp/s115_softdevice/mcuboot
S145:
Hardware platform
PCA
Board target
PCA10156
bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice/mcuboot
nRF54L15 DK (emulating nRF54L10)
PCA10156
bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice/mcuboot
nRF54L15 DK (emulating nRF54L05)
PCA10156
bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice/mcuboot
PCA10184
bm_nrf54lm20dk/nrf54lm20a/cpuapp/s145_softdevice/mcuboot
PCA10214
bm_nrf54ls05dk/nrf54ls05b/cpuapp/s145_softdevice/mcuboot
PCA10188
bm_nrf54lv10dk/nrf54lv10a/cpuapp/s145_softdevice/mcuboot
Overview
The LED Button Service (LBS) is a custom service that controls the state of an LED and sends notifications when a button changes its state.
You can use the sample to transmit the button state from your development kit to another device.
User interface
- Button 2:
Button for the LBS Button State characteristic.
- LED 0:
Lit when the device is initialized.
- LED 1:
Lit when a device is connected.
- LED 2:
LED controlled through the LBS LED State characteristic.
Building and running
This sample can be found under samples/bluetooth/ble_lbs/ in the Bare Metal folder structure.
For details on how to create, configure, and program a sample, see Getting Started with the samples.
Testing
You can test this sample using nRF Connect for Desktop with the Bluetooth Low Energy app and the Serial Terminal app. Make sure that these are installed before starting the testing procedure.
Compile and program the application.
In the Serial Terminal, observe that the
BLE LBS sample initializedmessage is printed.Observe that the
Advertising as nRF_BM_LBSmessage is printed. You can configure the advertising name using theCONFIG_SAMPLE_BLE_DEVICE_NAMEKconfig option. For information on how to do this, see Configuring Kconfig.In nRF Connect for Desktop, scan for advertising devices. If the device is not advertising, reset the board with the Reset Board option in Visual Studio Code or by pressing the reset button on the development kit.
Connect to your device. The terminal output in Visual Studio Code indicates
Peer connected.In nRF Connect for Desktop, go to Nordic LED and Button Service and change Blinky LED state to 01. The terminal output in Visual Studio Code indicates
Received LED ON!.Change the Blinky LED state value back to 00. The terminal output in Visual Studio Code indicates
Received LED OFF!.In the Blinky Button State characteristic, subscribe to button notifications by pressing the Toggle notifications button.
Observe that you receive a button state notification when pressing Button 2 on the kit.