Having problem with nrf24 receiving

Hello i'm using the following code for sending data

#include <SPI.h>
#include <RH_NRF24.h>
RH_NRF24 nrf24;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
while (!Serial)
; // wait for serial port to connect. Needed for Leonardo only
if (!nrf24.init())
Serial.println("init failed");
// Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
if (!nrf24.setChannel(1))
Serial.println("setChannel failed");
if (!nrf24.setRF(RH_NRF24::DataRate2Mbps, RH_NRF24::TransmitPower0dBm))
Serial.println("setRF failed");
}

void loop() {
uint8_t data[] = "Hello";
nrf24.send(data, sizeof(data));
nrf24.waitPacketSent();
Serial.println((long)data);
Serial.println("Sent a reply");
// put your main code here, to run repeatedly:
delay(1000);

}

And following code for receiving

#include <SPI.h>
#include <RH_NRF24.h>

RH_NRF24 nrf24;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
while (!Serial)
; // wait for serial port to connect. Needed for Leonardo only
if (!nrf24.init())
Serial.println("init failed");
// Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
if (!nrf24.setChannel(1))
Serial.println("setChannel failed");
if (!nrf24.setRF(RH_NRF24::DataRate2Mbps, RH_NRF24::TransmitPower0dBm))
Serial.println("setRF failed");
}

void loop() {
// put your main code here, to run repeatedly:
nrf24.waitPacketSent();
// Now wait for a reply
uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);

if (nrf24.waitAvailableTimeout(500))
{
// Should be a reply message for us now
if (nrf24.recv(buf, &len))
{
Serial.print("got reply: ");
Serial.println((char*)buf);
}
else
{
Serial.println("recv failed");
}
}
else
{
Serial.println("No reply, is nrf24_server running?");
}
delay(400);
}

serial monitor shows such results on serial monitor at the receiving end :confused: even with several other codes

got reply: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

Kindly help me out!

That probably means the monitor baud rate, lower right in monitor, is not the same as in the sketch.

No... it is definitely the same!! i make sure of this every time i run the code..

Rida_Sagheer:
Kindly help me out!

Before posting, make sure to follow recommendations at : ....click here.....

Also, if everything appears to be correct with the code, then you could also try putting an electrolytic capacitor (eg 100 uF) across the voltage supply pin and ground pin of your NRF24L01+ modules.

Have a look at this Simple nRF24L01+ Tutorial - it works for me and for other Forum members.

...R

I ran into a problem when I started working with them. I was using a separate power source for the NRF24 and couldnt get them to talk correctly or display accurate results. Found an old thread that suggested to make sure the grounds of the arduino and power supply for the NRF were tied together. That fixed my issue and everything started working properly.