Important: Before you run this example, make sure to program the SoftDevice.
The Heart Rate example applications show the usage of the Heart Rate Monitor profile.
The Receiver application connects to the nearest heart rate monitor (HRM) in range and prints out incoming page data. The actual channel state is indicated by the ANT channel state indicator.
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_rx
If a time-out occurs during search (30 seconds by default), the ANT channel is closed and the device is put into sleep mode. To wake it up, press Button 4. You can also put the device in sleep mode by pressing Button 4 while it is searching (see BSP ANT Button Module).
The Transmitter application simulates a Heart Rate Monitor transmitter. It transmits the heart rate information in the main data page (page 4). Device-specific information is transmitted at a slower rate in the background data pages (pages 1-3). The application prints out outgoing page data. The actual channel state is indicated by the ANT channel state indicator.
The profile information is generated by the ANT HRM simulator.
There are two ways to modify the profile information (heart rate):
You can select how the profile information is modified by using the "MODIFICATION_TYPE" field in the sdk_config.h
file.
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
Note: You can use a custom channel or encryption when running any of the ANT examples. When adding a new channel or encryption, remember to update SoftDevice ANT event handler configuration.
You can test the Heart Rate example in different ways:
Note that UART is not available when you use the D52 Starter Kit from Garmin Canada.
The following information should be output on the console for the transmitter:
ANT HRM channel 0 init ANT HRM channel 0 open HRM TX Page number: 0 Heart beat count: 0 Computed heart rate: 0 Heart beat event time: 0.000s HRM TX Page number: 0 Heart beat count: 1 Computed heart rate: 150 Heart beat event time: 0.399s HRM TX Page number: 0 Heart beat count: 1 Computed heart rate: 150 Heart beat event time: 0.399s
The following information should be output on the console for the receiver:
ANT HRM channel 0 init ANT HRM channel 0 open HRM RX Page Number: 0 Heart beat count: 159 Computed heart rate: 154 Heart beat event time: 14.083s Page was updated HRM RX Page Number: 0 Heart beat count: 160 Computed heart rate: 156 Heart beat event time: 14.467s Page was updated HRM RX Page Number: 0 Heart beat count: 160 Computed heart rate: 156 Heart beat event time: 14.467s Page was updated HRM RX Page Number: 2 Heart beat count: 161 Computed heart rate: 160 Heart beat event time: 14.842s Manufacturer ID: 2 Serial No (upper 16-bits): 0xABCD Page was updated HRM RX Page Number: 0 Heart beat count: 162 Computed heart rate: 162 Heart beat event time: 15.212s Page was updated
If you are testing the HRM Transmitter button version, observe that the computed heart rate value increases when pressing Button 1 and decreases when pressing Button 2.
If you are testing the HRM Transmitter auto version, observe that the computed heart rate value periodically rises and falls.
<InstallFolder>\examples\ant\ant_plus\ant_hrm\hrm_tx\hrm_rx_device_profile.xml
. Alternatively, you can configure the device channel manually:Received BROADCAST_DATA_0x4E :: 4e, 00-00-FF-FF-FF-09-60-F1-96 Received BROADCAST_DATA_0x4E :: 4e, 00-00-FF-FF-FF-A2-61-F2-96 Received BROADCAST_DATA_0x4E :: 4e, 00-00-FF-FF-FF-3B-63-F3-96 Received BROADCAST_DATA_0x4E :: 4e, 00-00-FF-FF-FF-D4-64-F4-96 Received BROADCAST_DATA_0x4E :: 4e, 00-80-FF-FF-FF-6D-66-F5-96 Received BROADCAST_DATA_0x4E :: 4e, 00-80-FF-FF-FF-06-68-F6-96 Received BROADCAST_DATA_0x4E :: 4e, 00-80-FF-FF-FF-9F-69-F7-96 Received BROADCAST_DATA_0x4E :: 4e, 00-80-FF-FF-FF-38-6B-F8-96 Received BROADCAST_DATA_0x4E :: 4e, 00-00-FF-FF-FF-D1-6C-F9-96 Received BROADCAST_DATA_0x4E :: 4e, 00-00-FF-FF-FF-6A-6E-FA-96Each message can be decoded according to the ANT message protocol and the Heart Rate Monitor ANT+ device profile.
To use the ANT+ Simulator tools, you must set the ANT+ Network Key to a proper value.
You can then use the ANT+ Display Simulator to test the HRM Transmitter and the ANT+ Sensor Simulator to test the HRM Receiver. See the documentation of the ANT+ Simulator tools at thisisant.com for information about how to use these tools.