NeilChaudhary
Published

Arduino Bluetooth Basic Tutorial

I am here to show you how to control your appliances through your smartphone

BeginnerProtip2,435
Arduino Bluetooth Basic Tutorial

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
LED (generic)
LED (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
Android device
Android device
×1

Software apps and online services

LED Controller
Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Diagram

Make connections according to diagram

Code

Code

C/C++
char data = 0;            //Variable for storing received data
void setup()
{
    Serial.begin(9600);   //Sets the baud for serial data transmission                               
    pinMode(13, OUTPUT);  //Sets digital pin 13 as output pin
}
void loop()
{
   if(Serial.available() > 0)      // Send data only when you receive data:
   {
      data = Serial.read();        //Read the incoming data & store into data
      Serial.print(data);          //Print Value inside data in Serial monitor
      Serial.print("\n");        
      if(data == '1')              // Checks whether value of data is equal to 1
         digitalWrite(13, HIGH);   //If value is 1 then LED turns ON
      else if(data == '0')         //  Checks whether value of data is equal to 0
         digitalWrite(13, LOW);    //If value is 0 then LED turns OFF
   }
}

Credits

NeilChaudhary

NeilChaudhary

1 project • 0 followers

Comments