How would I get the arduino to check the data coming via nrf24l01?

I’m sending data from an nfr24l01 to another nfr24l01. But I would like to check the transmitted data to see if it matches a value on the receiving arduino. If it matches I would like to turn on a motor. I tried an if statement but it won’t transmit.
Thanks everyone.

Transmitter Code:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(7, 8);

const byte address[6] = "00001";

void setup() {
    radio.begin();
    radio.openWritingPipe(address);
    radio.setPALevel(RF24_PA_MIN);
    radio.stopListening();
}

void loop () {
  delay(1000);
  char text[] = "Good";
  radio.write(&text, sizeof(text));
  delay(1000);

Receiver Code:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <VirtualWire.h>

RF24 radio(7, 8);

const byte address[6] = "00001";


void setup () {
  pinMode(2, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(9, OUTPUT);
  analogWrite(9, 0);
  
  Serial.begin(9600);
  radio.begin();
    radio.openReadingPipe(0, address);
    radio.setPALevel(RF24_PA_MIN);
    radio.startListening();
}

void loop() {
    if (radio.available()) {
      char text[] = "";
      radio.read(&text, sizeof(text)); 
      
char c = text;
       if (c = "Good") {
       Serial.println(text);
       digitalWrite(2, HIGH);
       digitalWrite(4, LOW);
       analogWrite(9, 200);
       delay(5000);
       digitalWrite(2, LOW);
       digitalWrite(4, HIGH);
       analogWrite(9, 200);
       delay(1000);
    }
    
    else {
    analogWrite(9, 0);
    }
}
}

This won't work

      char text[] = "";
      radio.read(&text, sizeof(text));

the array text[] must be pre-defined to be the same size as the data being sent.

Have a look at this Simple nRF24L01+ Tutorial

When you have received the text you can use the strcmp() function to compare it with some other piece of text.

Life will be easier of you can just transmit a single character such as 'G' rather than "Good" because you can compare single characters directly with

if (recvdChar == storedChar) {

...R

I got this, if command still won’t work.

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <VirtualWire.h>


RF24 radio(7, 8);

const byte address[6] = "00001";

String stringOne, stringTwo;

void setup () {
  pinMode(2, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(9, OUTPUT);
  analogWrite(9, 0);
  
  Serial.begin(9600);
  radio.begin();
    radio.openReadingPipe(0, address);
    radio.setPALevel(RF24_PA_MIN);
    radio.startListening();
}


void loop() {
    if (radio.available()) {
      char text[32] = "";
      radio.read(&text, sizeof(text)); 

   stringOne = String(text);
   stringTwo = String("1");

  

   if (strcmp(text, "1") == 0)  {
   
       Serial.println(text);
       digitalWrite(2, HIGH);
       digitalWrite(4, LOW);
       analogWrite(9, 200);
       delay(5000);
       digitalWrite(2, LOW);
       digitalWrite(4, HIGH);
       analogWrite(9, 200);
       delay(1000);
    }
    }
    else {
    analogWrite(9, 0);
    }

}

thunderstorm: I got this from google, if command still won't work.

If you try one of the examples in my tutorial (which I am familiar with) I will be able to help you.

Grabbing stuff randomly from Google is not the sort of methodical approach that is essential for getting a wireless system to work.

...R