Getting the free Adafruit Bluefruit LE Connect App
To interact with your board from your phone or tablet, you'll use the Adafruit Bluefruit LE Connect App. Install it from the Apple App Store or Google Play App Store.
Find Your nRF52840 Board
If you're in a situation where there are multiple nRF52840 boards available, and you need to figure out which one is yours, there is a simple solution.
Plug your board into your computer, connect to the serial console, and connect to the REPL. You should see the >>>
prompt. From the REPL, run the following commands:
from adafruit_ble import BLERadio ble = BLERadio() ble.name
This will return something like CIRCUITPYxxxx where "xxxx" is four alphanumeric digits. For example, CIRCUITPY34e7 is a possible option. This is the name of your board as it will show up in the Adafruit Bluefruit LE Connect app!
Start your Adafruit nRF52840 board with code running from code.py. You must have Bluetooth connectivity code running for this to work! The examples on the following pages have ready to go CircuitPython code.py scripts to try out.
For your board to appear in the app, in your code.py, you must have the following code at a minimum:
from adafruit_ble import BLERadio from adafruit_ble.advertising.standard import ProvideServicesAdvertisement from adafruit_ble.services.nordic import UARTService ble = BLERadio() uart = UARTService() advertisement = ProvideServicesAdvertisement(uart) ble.start_advertising(advertisement) while True: # Normally other work would be done here after connecting. pass
Next, start up the Bluefruit LE Connect app, and make sure it's in Central Mode (left button on the bottom). When you start the app, you should see a device named CIRCU or CIRCUITPY. If there's a long list of devices, you can shorten it by turning on the "Must have UART Service" switch.
To connect to the Adafruit nRF52840, touch the Connect button. You should see "Connecting" and then "Discovering Services".
If you don't see CIRCU or CIRCUITPY right away, try pulling down to refresh. If that doesn't work, try turning Bluetooth off and back on on your phone or tablet and restarting the app.
Device Menu
After you connect, you'll see a menu of how you can interact with the device. Choose Controller.
Control Pad
Here's the Control Pad screen. You can use the buttons as inputs in CircuitPython. For example, you could have code that moved a servo arm up and down when the up or down button is pressed.
Color Picker
To change the color of the NeoPixels, use the Color Picker screen. Choose a color and press Send Selected Color.
Stream Sensor Data
There are multiple options under Stream Sensor Data including Accelerometer. You enable these options to stream the associated data from your mobile device to your Adafruit nRF52840 board, and use CircuitPython to read that data.
For example, if you have code that reads the acceleration data from your mobile device, you'd want to enable Accelerometer once you connected to the app.
Check out this detailed guide for more information about the Adafruit Bluefruit LE Connect application.
Text editor powered by tinymce.