Led On/Off using HC-05 Bluetooth Module
& Arduino Uno
Components/Equipment Required:
3.
Smart
Phone
5.
Breadboard
Circuit
Diagram:
Arduino Program:
int
ledPin=13;
int
state=0;
int
flag=0;
void
setup()
{
pinMode(ledPin,OUTPUT);
digitalWrite(ledPin,LOW);
Serial.begin(9600);
}
void loop()
{
if(Serial.available()>0)
{
state= Serial.read();
flag=0;
}
if (state == '0')
{
digitalWrite(ledPin,LOW);
if(flag==0)
{
Serial.println("LED: off ");
flag=1;
}
}
else if (state == '1')
{
digitalWrite(ledPin,HIGH);
if(flag==0)
{
Serial.println("LED: on ");
flag=1;
}
}
}
Android Application:
Android application is named as “Bluetooth Terminal HC-05”
Pairing code is “1234”