Example Code

We have tons of examples that will get you going with the Bluefruit, and its really easy! Since we have one library for both wearable and non-wearable Bluefruit's, the example code is the same but may require some minor tweaks to adjust for Flora.

Most importantly, the flora bluefruit is for use with Hardware Serial only and does not have flow control pins. Also, we expect you will not use the mode pad so you can keep the switch set to CMD and then change into Data mode by sending +++ .

Configuring for Flora

For all of the examples, look near the top for a line like this:

Download: file
//#define BLUEFRUIT_HWSERIAL_NAME           Serial1

and remove the // comment marks. Do the same for:

Download: file
//Adafruit_BluefruitLE_UART ble(BLUEFRUIT_HWSERIAL_NAME, BLUEFRUIT_UART_MODE_PIN);

Next, remove the code for the SoftwareSerial type, find these lines and delete them:

Download: file
/* Create the bluefruit object, either software serial... */

SoftwareSerial bluefruitSS = SoftwareSerial(BLUEFRUIT_SWUART_TXD_PIN, BLUEFRUIT_SWUART_RXD_PIN);

Adafruit_BluefruitLE_UART ble(bluefruitSS, BLUEFRUIT_UART_MODE_PIN,
                      BLUEFRUIT_UART_CTS_PIN, BLUEFRUIT_UART_RTS_PIN);

Finally, unless you happen to be using the MODE pad, make sure BLUEFRUIT_UART_MODE_PIN is set to -1

Download: file
#define BLUEFRUIT_UART_MODE_PIN         -1   // Not used with FLORA

Same with RTS and CTS, find these lines and set both to -1

Download: file
#define BLUEFRUIT_UART_CTS_PIN          -1   // Not used with FLORA
#define BLUEFRUIT_UART_RTS_PIN          -1   // Not used with FLORA
This guide was first published on May 12, 2015. It was last updated on May 12, 2015.
This page (Example Code) was last updated on Aug 14, 2020.