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 even with several other codes
got reply: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
Kindly help me out!