HC-05 Bluetooth Module Interfacing With ARM MBED - MBED
HC-05 Bluetooth Module Interfacing With ARM MBED - MBED
HC-05 is a Bluetooth device used for wireless communication with Bluetooth enabled devices (like smartphone). It
communicates with microcontrollers using serial communication (USART).
Default settings of HC-05 Bluetooth module can be changed using certain AT commands.
As HC-05 Bluetooth module has 3.3 V level for RX/TX and microcontroller can detect 3.3 V level, so, there is need to shift TX
voltage level of HC-05 module to microcontroller.
For more information about HC-05 Bluetooth module and how to use it, refer the topic HC-05 Bluetooth module.
Interfacing Diagram
Interfacing HC-05 Bluetooth Module with ARM MBED
Note: Default Bluetooth name of the device is “HC-05” and default PIN (password) for connection is either “0000” or “1234”.
Example
Here, we will transmit any character or string from Smartphone via Bluetooth to the ARM MBED and toggle the LED1 of mbed
board.
Download and install a Bluetooth terminal application on your phone and use it to connect to the HC-05 Bluetooth module.
Program
#include "mbed.h"
#if defined(TARGET_LPC1768)
#elif defined(TARGET_LPC4330_M4)
#endif
DigitalOut myled(LED1);
DigitalOut myled4(LED4);
int main()
blue.baud(115200);
pc.baud(115200);
pc.printf("Bluetooth Start\r\n");
while (1)
if (blue.readable())
pc.putc(blue.getc());
myled = !myled;
if (pc.readable())
blue.putc(pc.getc());
myled4 = !myled4;