The BLEUart example sketch allows you to send and receive text data between the Arduino and a connected Bluetooth Low Energy Central device on the other end (such as you mobile phone using the Adafruit Bluefruit LE Connect application for Android or iOS in UART mode).
Opening the Sketch
To open the ATCommand sketch, click on the File > Examples > Adafruit_BluefruitLE_nRF51 folder in the Arduino IDE and select bleuart_cmdmode:
This will open up a new instance of the example in the IDE, as shown below:
Configuration
Check the Configuration! page earlier to set up the sketch for Software/Hardware UART or Software/Hardware SPI. The default is hardware SPI
If using software or hardware Serial UART:
- This tutorial does not need to use the MODE pin, make sure you have the mode switch in CMD mode if you do not configure & connect a MODE pin
- Don't forget to also connect the CTS pin on the Bluefruit to ground if you are not using it! (The Flora has this already done)
Running the Sketch
Once you upload the sketch to your board (via the arrow-shaped upload icon), and the upload process has finished, open up the Serial Monitor via Tools > Serial Monitor, and make sure that the baud rate in the lower right-hand corner is set to 9600 (if an issue, try 115200):
Once you see the request, use the App to connect to the Bluefruit LE module in UART mode so you get the text box on your phone
Any text that you type in the box at the top of the Serial Monitor will be sent to the connected phone, and any data sent from the phone will be displayed in the serial monitor:
You can see the incoming string here in the Adafruit Bluefruit LE Connect app below (iOS in this case):
The response text ('Why hello, Arduino!') can be seen below:
Text editor powered by tinymce.