Go Down

Topic: How do I compare the received data from a nRF24L01 module? (Read 60 times) previous topic - next topic

BrainTrance

I can PRINT the received data, but I can't compare them with something else.

I use RF24 library.

On transmitter side I send the array of chars char text[] = "porta"; like this:

Code: [Select]
void porta_function() {
  char text[] = "porta";
  radio.write(&text, sizeof(text)); }


On receiver side I receive and print this array with no problem:

Code: [Select]
void loop() {
  while(radio.available()) {
   
    char text[32] = "";
    radio.read(&text, sizeof(text));
    Serial.println(text); }


But when I add in the loop this:
if(text == "led") {
Serial.println("OK");

}
the whole loop stops working although it compiles. I don't even get the print of Serial.println(text)

What is my mistake?

gfvalvo

No technical questions via PM. They will be ignored. Post your questions in the forum so that all may learn.

Go Up