Bluetooth: Peripheral Heart Rate Monitor with Coded PHY
The Peripheral Heart Rate Monitor with Coded PHY offers similar functionality to the Bluetooth: Peripheral HR sample from Zephyr. However, this sample supports LE Coded PHY.
The sample supports the following development kits:
If you use nRF5340 DK, the additional configuration of the network core will be taken from the
For more details, see Image-specific variables.
The sample also requires a device running a Heart Rate Server with LE Coded PHY support to connect to. For example, another development kit running the Bluetooth: Central Heart Rate Monitor with Coded PHY sample.
The sample demonstrates a basic Bluetooth® Low Energy Peripheral role functionality that exposes the Heart Rate GATT Service with LE Coded PHY support, which is not available in Zephyr Bluetooth LE Controller (See Bluetooth LE Controller for more information). Once it connects to a Central device, it generates dummy heart rate values. You can use it together with the Bluetooth: Central Heart Rate Monitor with Coded PHY sample.
The user interface of the sample depends on the hardware platform you are using.
- LED 1:
Blinks when the main loop is running (that is, the device is advertising) with a period of two seconds, duty cycle 50%.
- LED 2:
Lit when the development kit is connected.
This sample can be found under
samples/bluetooth/peripheral_hr_coded in the nRF Connect SDK folder structure.
To build the sample with Visual Studio Code, follow the steps listed on the How to build an application page in the nRF Connect for VS Code extension documentation. See Building and programming an application for other building and programming scenarios and Testing and debugging an application for general information about testing and debugging in the nRF Connect SDK.
After programming the sample to your development kit, you can test it by connecting to another development kit that runs the Bluetooth: Central Heart Rate Monitor with Coded PHY.
Connect to the kit that runs this sample with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.
Reset the kit.
Program the other kit with the Bluetooth: Central Heart Rate Monitor with Coded PHY sample.
Wait until the Coded advertiser is detected by the Central. In the terminal window, check for information similar to the following:
Connected: xx.xx.xx.xx.xx.xx (random), tx_phy 4, rx_phy 4
In the terminal window, observe that notifications are enabled:
<inf> hrs: HRS notifications enabled
This sample uses the following nRF Connect SDK library:
This sample uses the following Zephyr libraries: