By placing the BLEFriend module in 'UART Data' mode (set the mode selection switch to UART or setting the MODE pin to gound) you can use the module as a 'transparent UART connection' to the Bluefruit app. This makes data transfer super simple. Data is sent to the app when any 9600 baud data is received on the RXI pin and any data from the app is automatically transmitted via the TXO pin
In order to keep from overloading your microcontroller, you can use the flow control pins. Keep the CTS pin high until you're ready for more data, then ground it to let the Bluefruit module know you're ready for more data!
You can determine if you are in Data Mode by looking at the mode LED. It should blink two times followed by a three second pause, as shown below:
You can then connect the the app in UART mode and send/receive data transparently
Switching Command/Data Mode via +++
On either side of the connection (via the Arduino Uno or in your mobile app), you can dynamically switch between command and data mode by sending the "+++\n" string, as detailed in the +++ command summary.
If you start in data mode, you can send text for example, with "+++\nATI\n+++\n", which will cause the Bluefruit LE module to switch to command mode, execute the ATI command, and then switch back to data mode.
# Start in Data Mode > Hello, World! Data mode! # Send command to switch modes > +++ # Bluefruit LE module switches to CMD mode # Send ATI command and wait for the response > ATI < BLEFRIEND < nRF51822 QFAAG00 < B122AAC33F3D2296 < 0.6.2 < 0.6.2 < May 01 2015 < OK # Switch back to DATA mode > +++ < OK # We're back in data mode now Welcome back!
Text editor powered by tinymce.