Important: Before you run this example, make sure to program the SoftDevice .
The Command Line Interface over BLE (CLI BLE) Application is an example that showcases how BLE NUS ( Nordic UART service ) can be used as a transport for a console.
The example folder contains a Python script that uses the PC BLE driver and an additional board to connect to the example and forward any BLE NUS traffic to a network port. A standard terminal, such as PuTTY, can be used to connect to a network port and run the console.
Console over RTT is also enabled in this example. Both consoles can be opened and used independently.
- Note
- This application is not power optimized!
- The application will stop advertising after 3 minutes and 30 seconds and go to System Off mode. Press Button 1 to restart advertising.
Testing
Perform the following steps to test the CLI BLE Application:
-
Install pc-ble-driver-py:
pip install pc-ble-driver-py
- Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
-
Start the
ble_serial.pyscript, for example:ble_serial.py --snr 680834186 --name Nordic_CLI --com COM115 --family NRF51 - Open a terminal, for example PuTTY. Set the Connection Type to Raw and the Destination Address to 127.0.0.1:8889 .
- Observe that the BSP_INDICATE_CONNECTED state is indicated.
- Press Enter in the terminal. A console prompt is displayed.
- Use the Tab key to print the available commands.
-
Use commands
led onandled offto control LED 4. -
Mandatory terminal settings:
Extra settings for RTT terminal:,