Bluetooth: Central Heart Rate Monitor with Coded PHY¶
The Central Heart Rate Monitor with Coded PHY offers similar functionality to the Bluetooth: Central / Heart-rate Monitor sample from Zephyr. However, this sample specifically looks for heart rate monitors using LE Coded PHY.
Overview¶
The sample demonstrates a Bluetooth LE Central role functionality by scanning for other Bluetooth LE devices that run a Heart Rate Server with LE Coded PHY support. It then establishes a connection to the first Peripheral device in range. It can be used together with the Bluetooth: Peripheral Heart Rate Monitor with Coded PHY sample.
Requirements¶
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
Build target |
---|---|---|---|
PCA10095 |
|
||
PCA10059 |
|
||
PCA10056 |
|
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: Peripheral Heart Rate Monitor with Coded PHY sample.
Building and Running¶
This sample can be found under samples/bluetooth/central_hr_coded
in the nRF Connect SDK folder structure.
See Building and programming a sample application for information about how to build and program the application.
Testing¶
After programming the sample to your board, you can test it by connecting to another board that runs the Bluetooth: Peripheral 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 board.
Program the other board with the Bluetooth: Peripheral Heart Rate Monitor with Coded PHY.
Wait until the Coded advertiser is detected by the Central. In the terminal window, check for information similar to the following:
Filters matched. Address: xx.xx.xx.xx.xx.xx (random) connectable: yes Connection pending Connected: xx.xx.xx.xx.xx.xx (random), tx_phy 4, rx_phy 4 The discovery procedure succeeded
Observe that the received notifications are output in the terminal window:
[SUBSCRIBED] [NOTIFICATION] Heart Rate 113 bpm [NOTIFICATION] Heart Rate 114 bpm [NOTIFICATION] Heart Rate 115 bpm
Dependencies¶
This sample uses the following nRF Connect SDK libraries:
In addition, it uses the following Zephyr libraries:
include/zephyr/types.h
include/errno.h
include/zephyr.h
include/sys/printk.h
include/sys/byteorder.h
-
include/kernel.h
include/bluetooth/bluetooth.h
include/bluetooth/conn.h
include/bluetooth/gatt.h
include/bluetooth/uuid.h