Bluetooth HC05 LED control CloudX

  • img
Project Details

This is a mini project on how to build a simple smart phone control hardware using Bluetooth technology.

In this project, I used the popular HC05 bluetooth module that uses UART AT command. 

The Bluetooth module has VCC, GND, TX and RX pin which is connected to the cloudx Priscilla board 5V, GND, RX and TX respectively.

HC05     |     Priscilla

VCC.      |     5V

GND.     |      GND

TX.        |      RX

RX.        |      TX

 

In the code,  Bluetooth_begin(9600) is used to set the communication baudrate, I used 9600.

The Bluetooth_available () is used to detect when data is sent from the smartphone app.

Bluetooth_read() is used to read out the data sent and store in a variable. Then I checked the variable to see if data sent is '1'. If it's '1' then it will toggle pin1.

 

You can search and download any Bluetooth serial terminal on Google Playstore.

Code

#include <CloudX\Priscilla_2620.h>
#include <CloudX\Bluetooth_HC05.h>
char dataRecieved;
setup(){
pinMode(1, OUTPUT);
Bluetooth_begin(9600);

loop(){
if(Bluetooth_available ()){
dataRecieved = Bluetooth_read();
if(dataRecieved == '1') pin1 = ~pin1;
}
}
}

Share this with friends