I am beginner and have just started to use nrf24l01. Here the problem is transmitter sends the data but receiver does not read the that though radio.available() returns true. Receiver print only blank in serial monitor and continues to next line. Please help me to figure it out and tell me the solution.
Transmitter code:-
#include<SPI.h>
#include<nRF24L01.h>
#include<RF24.h>
RF24 radio (7,8);
int check = 1;
const byte address[6] = "23269";
void setup() {
radio.begin();
radio.openWritingPipe(address);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_LOW);
radio.stopListening();
}
void loop() {
const char text[] = "Hello World";
radio.write(&text,sizeof(text));
delay(1000);
}
Receiver code:-
#include<SPI.h>
#include<nRF24L01.h>
#include<RF24.h>
RF24 radio (7,8);
const byte address[6] = "23269";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0,address);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MAX);
radio.startListening();
}
void loop() {
if(radio.available()){
char text[32] = "";
radio.read(&text,sizeof(text));
String call = String(text);
Serial.println(call);
delay(2000);
}
}