Skip to content

BLE CLI Example

Description

The Command Line Interface over BLE (BLE CLI) Application is an example that demonstrates how BLE NUS (Nordic UART service) can be used as a transport for a console.

Web Device CLI is a web-based command line interface using Web Bluetooth API. It implements the Nordic UART Service (NUS) with Bluetooth Low Energy. This web utility can be used to connect to the BLE CLI example.

Tip

Before you start building, remember to set up the nRF5 SDK development environment first. See Setup the nRF5 SDK for details.

Building the example

You can find the source code and the project file of the example in the following folder: examples/nrf5-sdk/ble_app_cli.

Open terminal and navigate to the directory with the example Makefile:

cd ./examples/nrf5-sdk/ble_app_cli/armgcc

Run make merge to build the application and merge with the Softdevice:

make merge

Programming the firmware

If compiled successfully, the firmware is located in ble_app_cli/armgcc/_build with the name nrf52840_xxaa_s140.hex.

Connect the debugger USB port to your PC using the provided USB-C Cable. A disk drive called M2-DOCK will be automatically detected by the computer.

Run the following command in ble_app_cli/armgcc to program the board:

make flash_all

Tip

See Programming section for details about how to program the nRF52840 M.2 Module.

Testing

Perform the following steps to test the BLE CLI example:

  1. Open the Web Device CLI page in a Chrome 56+ browser.

  2. Click Connect to scan devices.

  3. Pair the Nordic_CLI discovered in the list.

  4. Observe that the LED stays GREEN and the ble_cli:~$ prompt is displayed.

  5. Press the Tab on your keyboard to print the available commands.

  6. Use command led {R} {G} {B} to set the RGB LED color and observe the RGB LED on the module.

Create an Issue

Interested in contributing to this project? Want to report a bug? Feel free to click here: