Code

Unit8_t buf[RH_NRF24_MAX_MESSEGE_LEN];
Unit8_t len=sizeof(buf);
If(nrf24.recv(buf,&len)
{
Serial.println((char*)buf);
}

How to read the messege to use it in a condition statement .tried a lot but i can't can any one please help me to solve the problem.

Unit8_t

Huh?

Here is an excellent RF24 tutorial that might help.

Nrf24L01-2.4GHz-HowTo

I think this line

If(nrf24.recv(buf,&len)

should be

if(nrf24.recv(&buf, len)

or just

if(nrf24.recv(buf,len)

If that does not make sense it is because you have not posted a complete program.

Don't re-type code because you just make mistakes. Use copy and paste.

...R

How to read the messege

nrf24.recv(buf,&len)

to use it in a condition statement

if(memcmp(buf, "OP IS CLUELESS") == 0)
{
   Serial.print("OP has some learning to do");
}

PaulS:

{

Serial.print("OP has some learning to do");
}

Perhaps he was hoping you would play the role of teacher :slight_smile:

...R

Perhaps he was hoping you would play the role of teacher

OK. What does OP need to learn?

PaulS:
OK. What does OP need to learn?

as of now how to post code :slight_smile:
@op
You need to check whether any data is available first, some thing like

if(nrf.available>0){
   nrf.read(&buf, len);
}

sarouje:
as of now how to post code :slight_smile:
@op
You need to check whether any data is available first, some thing like

if(nrf.available>0){

nrf.read(&buf, len);
}

That won’t help a lot. There is no ‘read()’ member function in the NRF24 library, and the ‘recv()’ prototype, as Paul points out, is:-boolean recv(uint8_t *buf, uint8_t *len);
And shouldn’t this:-if(nrf.available>0){look like this:-if(nrf.available()>0){
So your example should be:-

if(nrf.available() > 0)
{
   nrf.recv(buf, &len);
}

I would check that more than just the 1 is available. Be a shame to have 1 available and then try to read 10

Delta_G:
I would check that more than just the 1 is available. Be a shame to have 1 available and then try to read 10

The nRF24 “available” tells whether a message has been received. It is not the same as Serial.available() which tells you how many characters have been received.

The standard payload length is 32 bytes but there is an option for dynamic payloads of varying sizes up to 32 bytes. There is a function getDynamicPayloadSize() to check that - but it would only be used after a successful available()

…R

Robin2:
The nRF24 "available" tells whether a message has been received. It is not the same as Serial.available() which tells you how many characters have been received.

The standard payload length is 32 bytes but there is an option for dynamic payloads of varying sizes up to 32 bytes. There is a function getDynamicPayloadSize() to check that - but it would only be used after a successful available()

...R

Cool. Learned something new. Thanks

There's a lot of teaching here for an OP unlikely to return.

Fortunately, the rest of us are learning as well!