ARDUINO BLUETOOTH COMMUNICATION USING MOBILE APP
This program can be used to interface bluetooth module(HC05) to arduino.
BUYING LINKS TO AMAZON BELOW :
PROGRAM :
const int led1 =13;
const int led2 =12;
void setup()
{
Serial.begin(38400);
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
}
void loop()
{
if(Serial.available())
{
String value = Serial.readStringUntil("'\n");
if(value =="123")
{
Serial.write("LED ON");
digitalWrite(led1,HIGH);
}
if(value=="456")
{
Serial.write("LED OFF");
digitalWrite(led1,LOW);
}
if(value=="789")
{
Serial.write("LED 2 ON");
digitalWrite(led2,HIGH);
}
if(value=="#")
{
Serial.write("LED 2 OFF");
digitalWrite(led2,LOW);
}
}
}
0 Comments