See the output of serial terminal
when i typed "Hello" with quotes.
12:03:46.536 -> Buffer Received= " No match found
12:03:46.569 ->
12:03:46.569 -> Buffer Received= Hello"
12:03:46.603 -> Found Hello
when i typed "HELLO" with quotes.
12:03:55.855 -> Buffer Received= " No match found
12:03:55.888 ->
12:03:55.888 -> Buffer Received= HELLO"
12:03:55.921 -> Found HELLO **See the output of serial terminal
when i typed "Hello" with quotes.
12:03:46.536 -> Buffer Received= " No match found
12:03:46.569 ->
12:03:46.569 -> Buffer Received= Hello"
12:03:46.603 -> Found Hello
when i typed "HELLO" with quotes.
12:03:55.855 -> Buffer Received= " No match found
12:03:55.888 ->
12:03:55.888 -> Buffer Received= HELLO"
12:03:55.921 -> Found HELLO**
when i typed "heLLo" with quotes.
12:04:04.016 -> Buffer Received= " No match found
12:04:04.049 ->
12:04:04.049 -> Buffer Received= heLLo"
12:04:04.082 -> Found heLLo
12:04:04.115 -> ****when i typed "heLLo" with quotes.
12:04:04.016 -> Buffer Received= " No match found
12:04:04.049 ->
12:04:04.049 -> Buffer Received= heLLo"
12:04:04.082 -> Found heLLo
12:04:04.115 ->****
When i typed without quotes, all i get No match found
** char buffer[100]; uint8_t index=0;
void setup() { Serial.begin(9600); _delay_ms(4000); }
void loop() { if(Serial.available()>0) { index=0; while(Serial.available()) { buffer[index++]=Serial.read(); }
char buffer[100];
uint8_t index=0;
void setup()
{
Serial.begin(9600);
_delay_ms(4000);
}
void loop()
{
if(Serial.available()>0)
{
index=0;
while(Serial.available())
{
buffer[index++]=Serial.read();
}
buffer[index]='\0';
Serial.println(' ');
Serial.print("Buffer Received");
Serial.print(buffer);
Serial.print('\t');
if(strstr(buffer, "Hello")!=NULL) Serial.println("Found Hello");
else if(strstr(buffer, "HELLO")!=NULL) Serial.println("Found HELLO");
else if(strstr(buffer, "heLLo")!=NULL) Serial.println("Found heLLo");
else Serial.println("No match found");
Serial.flush();
}
}
} } **