Important: Before you run this example, make sure to program the SoftDevice.
The Continuous Scanning Controller example demonstrates how to use continuous scanning to asynchronously send a message to the nearest device. In the image below, the controller (Node A) is in range to receive messages from nodes C, D, and E. When the user presses a button on the controller, it uses continuous scanning mode to identify the node with the strongest RSSI and then it sends back a command message to that node in the reverse direction. The continuous scanning mode is only active for a short period of time after pressing the button, making this suitable for battery-operated devices. For demonstration purposes, the asynchronous controller example is intended to be used in conjunction with ANT Scan and Forward example, but can be adapted to other control applications.
This example can be used with two or more development boards or one development board and one ANT USB stick attached to a PC running ANTware II.
Refer to the following table for functioning pattern of the LEDs on the controller:
LED | Function |
---|---|
BSP_LED_0 | Turns on when continuous scanning is active. |
BSP_LED_1 | Toggles when DEVICE_STATUS_PAGE is received on a channel in continuous scanning mode. |
BSP_LED_2 | Turns on if no nodes were found that are sending a DEVICE_STATUS_PAGE after continuous scanning. |
You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\ant\ant_continuous_scanning_controller
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 Continuous Scanning Controller example in different ways:
Refer to the following table for functioning pattern of the asynchronous controller buttons:
Button | Command |
---|---|
BSP_BUTTON_0 | Closest node – LED on. |
BSP_BUTTON_1 | Closest node – LED off. |
BSP_BUTTON_2 | All nodes – LED on. |
BSP_BUTTON_3 | All nodes – LED off. |
<InstallFolder>\examples\ant\ant_continuous_scanning_controller\ant_continuous_scanning_controller_test.xml
. Alternatively, you can configure the device channels manually: