BLE Nordic UART Service¶
Overview¶
The BLE Nordic UART Service sample demonstrates using Nordic UART Service to control the RGB LED on nRF52840 Connect Kit over Bluetooth Low Energy.
Tip
adafruit_ble
is pre-built into CircuitPython as a frozen module, so that it can be imported in the code directly.
Requirements¶
Before you start, check that you have the required hardware and software:
- nRF52840 Connect Kit running the CircuitPython firmware
- 1x USB-C Cable
- A smartphone or a tablet with nRF Toolbox installed
- Mu Editor
- A computer running macOS, Linux, or Windows 7 or newer
Running the code¶
To run the code, complete the following steps:
- Connect nRF52840 Connect Kit to your computer using the USB-C Cable.
- Start Mu Editor, click Load to open
code.py
in the CIRCUITPY drive. -
Copy and paste the following code into
code.py
and click Save: -
Your code will run as soon as the file is done saving. Start the nRF Toolbox app, tap UART to open the UART application.
- Connect to the device with the name
CIRCUITPY NUS
discovered in the UART application. -
Tap the blank buttons to create new commands. The following command assignments are configured with EOL set to LF :
- - Send
1
to toggle the RED LED. - - Send
2
to toggle the GREEN LED. - - Send
3
to toggle the BLUE LED.
- - Send
-
Tap to toggle the RGB LED. Observe that the RGB LED on the board turns on or off.