#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//create an RF24 object
RF24 radio(14, 33); // CE, CSN
String out, chk="welcome" , red="red" , yellow="yellow";
//address through which two modules communicate.
const byte address[6] = "00001";
const char text2[] = "Hello World";
void setup()
{
while (!Serial);
Serial.begin(9600);
radio.begin();
//set the address
radio.openReadingPipe(0, address);
//Set module as receiver
radio.startListening();
}
void loop()
{
//Read the data if available in buffer
if (radio.available())
{
char text[32] = {0};
radio.read(&text, sizeof(text));
Serial.println(text);
out=String(text);
if(out==chk){Serial.println("equal");}
if(out==red){Serial.println("red colour");}
if(out==yellow){Serial.println("yellow");}
}
}