Artemis Development with the Arduino IDE

Pages
Favorited Favorite 0

Bluetooth: LED

Install BLE Library

For users interested in the BLE functionality of the Apollo3 and Artemis boards, we have provided full support to the Arduino BLE library. Additional details about the library can be referenced from the documentation provided by Arduino.

Users who haven't already done so, will need to install the Arduino BLE library to continue with this example; please use the guide below, to get started with installing the Arduino BLE library:

Installing an Arduino Library

January 11, 2013

How do I install a custom Arduino library? It's easy! This tutorial will go over how to install an Arduino library using the Arduino Library Manager. For libraries not linked with the Arduino IDE, we will also go over manually installing an Arduino library.

Peripheral LED Example

Note: Users will need to download the NRF Connect app onto their phone. We highly recommend utilizing an Android phone as we have had difficulties with device connections in the app for Apple phones.

As in the prior examples, these steps will follow a similar procedure.

  1. From the drop down file menu, open the LED sketch: File > Examples > ArduinoBLE > Peripheral > LED.
  2. Save the sketch (File > Save As...) using the file drop down menu.
  3. Select the then, export the compiled binary code (Sketch > Export compiled Binary) using the sketch drop down menu.
  4. Drag and drop (or copy) the binary .bin file into the ARTEMIS mass storage drive. The storage drive will automatically eject once the programming is complete.
  5. To verify that the board is working and that the programming was successful, open a terminal emulator, such as TeraTerm or the Serial Monitor in the Arduino IDE. Connect to the serial port for the Artemis DK; don't forget to set the baud rate to 9600 bps.
  6. Click the reset button to begin the program. Users should see a BLE LED Peripheral message in the terminal emulator.
  7. Follow the steps and video below to control the STAT LED on the Artemis DK.
    1. Unlock the phone and enable the Bluetooth.
    2. Open the NRF app.
    3. Click on the Scan button on the upper right corner.
    4. In the results, locate the device labeled LED. Click on the CONNECT button to the right of the device name.
      • In the terminal emulator, users should see a Connected to central: message followed by the mac address of the phone.
    5. Once connected, locate the Unknown Service. It will have the following service UUID: 19B10000-E8F2-537E-4F6C-D104768A1214.
    6. Click on the service. Then, locate and click on the upload button (up arrow).
    7. A dialog box will open. We want to write a value, so locate the New Value text field, under the Write value drop-down menu option. Based on the control inputs to the LED, an LED on or LED off message will appear in the terminal emulator.
      • Enter 01 to turn the LED on. Then click the SEND button.
      • Enter 00 to turn the LED off. Then click the SEND button.

Utilizing the example with the NRF phone app.

bluetooth serial output
Serial output of the LED Bluetooth example. (Click to enlarge)