The Adafruit Bluefruit LE UART Friend is a versatile Bluetooth Low Energy (BLE) module designed for seamless wireless communication between microcontrollers, such as Arduino boards, and Bluetooth 4.0 (and later) enabled devices, including smartphones and tablets. This module can operate as either a BLE server (peripheral) or client (central), making it suitable for a wide range of applications such as remote control, data logging, and sensor monitoring.
Pin Number | Name | Description |
---|---|---|
1 | VIN | Power supply input (3.3V to 5V) |
2 | GND | Ground connection |
3 | TXO | UART transmit output (connect to microcontroller RX) |
4 | RXI | UART receive input (connect to microcontroller TX) |
5 | RTS | Request to Send (optional flow control) |
6 | CTS | Clear to Send (optional flow control) |
7 | DTR | Data Terminal Ready (used for mode selection) |
8 | MODE | Mode selection (pull high for COMMAND mode) |
#include <SoftwareSerial.h>
// Create a software serial object to communicate with the Bluefruit LE module
SoftwareSerial bluefruitSerial(10, 11); // RX, TX
void setup() {
// Set up the serial port for debugging
Serial.begin(9600);
// Start communication with the Bluefruit LE module
bluefruitSerial.begin(9600);
Serial.println("Bluefruit LE UART Friend example");
}
void loop() {
// Forward any data from the hardware serial to the Bluefruit LE module
if (Serial.available()) {
bluefruitSerial.write(Serial.read());
}
// Forward any data from the Bluefruit LE module to the hardware serial
if (bluefruitSerial.available()) {
Serial.write(bluefruitSerial.read());
}
}
Note: The above code uses pins 10 and 11 for software serial communication with the Bluefruit LE UART Friend. Adjust the pin numbers as needed for your specific setup. Ensure that the baud rate set in bluefruitSerial.begin()
matches the configured baud rate of the Bluefruit LE module.