Go Down

Topic: comparing data coming from serial (Read 205 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.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131