| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ANT and BLE Heart Rate Monitor Relay Application
This example requires the following SoftDevice: S332

Important: Before you run this example, make sure to program the SoftDevice.

The ANT and BLE Heart Rate Monitor Relay Application shows the concurrent use of the ANT and the BLE protocols. It implements the Heart Rate profile using the hardware delivered in the nRF5 Development Kit. In addition, it implements an ANT Heart Rate Profile Receiver. The aggregated data received from ANT is relayed and sent as BLE notifications.

The application includes the two BLE services in the Heart Rate profile:

- Heart Rate Service
- Device Information Service

When notification of Heart Rate Measurement characteristic is enabled, the Heart Rate Measurement, containing the current value for all the components of the Heart Rate Measurement characteristic, is notified each time there is new data received from the ANT connection.

This example is based on the BLE Heart Rate Application (ble_app_hrs). See that example for additional documentation.

Note
  This application is not power optimized!
  The application will stop advertising after 3 minutes and go to system-off mode. Push Button 1 to restart advertising.

# Setup

You can find the source code and the project file of the example in the following folder: `<InstallFolder>\examples\multiprotocol\ble_ant_app_hrm`

Button assignments:

- Button 1: Wake up from system-off and restart advertising.
- Button 2: Wake up, erase all bonds, and restart advertising.

# Testing

Test the Heart Rate Relay Application with the nRF Toolbox app, which is available on both iOS (App Store) and Android (Google Play).

You can also test the application with the Master Control Panel by performing the following steps:

1. Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
2. Connect to the device from Master Control Panel (the device will be advertising as 'Nordic_HRM'), then perform service discovery. Observe that the BSP_INDICATE_CONNECTED state is indicated.
3. Click the 'Enable services' button on the Master Control Panel. Observe that Heart Rate notifications are received every second.
4. Compile and program the ANT Heart Rate Monitor (HRM) transmitter example on the second board as a peer ANT device. You can find the source code and the project file of the example in the following folder: `<InstallFolder>\examples\ant\ant_plus\ant_hrm\hrm_tx` Alternatively, you can connect to an ANT heart rate belt if you change ANT_HRMRX_NETWORK_KEY to the ANT+ Network Key.
   Note
     The ANT+ Network Key is available for ANT+ Adopters. See thisisant.com for information about how to become an ANT+ Adopter and access the key.
5. Press the buttons on the board to increase or decrease the transmitted heart rate.
6. Observe that the value received in the Heart Rate notifications change according to the button presses.