Thanks, at last the code is working.i think somebody got angry and pushed me out from further reply.i wan't to say it that was my mistake.hope would learn the programming so that i would eat your brains less
i would thanks all of you mr.paul s,AWOL,jml.thank you.i leant lot from you,a lot yet to come and yes,its light bulb moment
.
#include <SoftwareSerial.h>
SoftwareSerial BTserial(10, 11); // RX | TX
// Connect the HC-05 TX to Arduino pin 10 RX.
// Connect the HC-05 RX to Arduino pin 11 TX
void setup()
{
Serial.begin(9600);
Serial.println("Arduino is ready");
BTserial.begin(9600);
BTserial.println("Bluetooth is ready");
}
void loop()
{
if (BTserial.available() > 0) {
String s = BTserial.readString();
if ( s == "hello") { // if the bluetooth read string is hello serially print hi
Serial.println("hi");
}
else if ( s == "hey") { // if bluetooth read string is hey serially print yeah
Serial.println("yeah");
}
else if (s != "hello" && s != "hey")
{
Serial.println("invalid"); //
}
}
}