Go Down

Topic: comparing data coming from serial (Read 444 times) previous topic - next topic


I have seen this subject in some threads, but cant make it work yet to compare

I send a char* from my serial message, I can log it ok ,but comparison with an  specific word is not working

Code: [Select]
void entro(char* valu)

 String mystr = String(valu);
 Serial.println("tomad tu strg::" + mystr);

 String ss = String("ss9");
 if (mystr == ss)
   Serial.println("si docto!");
 } //not working
  if (strcmp(valu, "ss9")  == 0)  // test to see if the two strings are equal
 }  //not working

So what is missing? how to compare the char* with a string?



how to compare the char* with a string?

How do you know that the code is not working? How do you expect us to know? You don't say what is in valu, nor do you show how the function is called. Nor have you presented any proof, like serial output.
The art of getting good answers lies in asking good questions.

Go Up