You are misusing the radio.read() function
Here is an example of how it can be used
// SimpleRx - the slave or the receiver
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//pins - not all #defines used but here for documentation
#define CE_PIN 9
#define CSN_PIN 10
#define MOSI_PIN 11
#define MISO_PIN 12
#define SCK_PIN 13
const byte thisSlaveAddress[5] = {'R', 'x', 'A', 'A', 'A'};
RF24 radio(CE_PIN, CSN_PIN);
unsigned long dataReceived;
bool newData = false;
//===========
void setup()
{
Serial.begin(115200);
Serial.println("SimpleRx Starting");
radio.begin();
radio.setDataRate( RF24_250KBPS );
radio.setPALevel(RF24_PA_MIN);
radio.openReadingPipe(1, thisSlaveAddress);
radio.startListening();
}
//=============
void loop()
{
getData();
showData();
}
//==============
void getData()
{
if ( radio.available() )
{
radio.read( &dataReceived, sizeof(dataReceived) );
newData = true;
}
}
void showData()
{
if (newData == true)
{
Serial.print("Data received ");
Serial.println(dataReceived);
newData = false;
}
}
and to go with it, the transmitter sketch
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//pins - not all #defines used but here for documentation
#define CE_PIN 9
#define CSN_PIN 10
#define MOSI_PIN 11
#define MISO_PIN 12
#define SCK_PIN 13
//const byte slaveAddress[5] = {'R', 'x', 'A', 'A', 'A'};
const unsigned char slaveAddress[] = {"RxAAA"};
RF24 radio(CE_PIN, CSN_PIN);
unsigned long numberToSend = 1000;
unsigned long currentMillis;
unsigned long prevMillis;
unsigned long txIntervalMillis = 1000; // send once per second
void setup()
{
Serial.begin(115200);
Serial.println("SimpleTx Starting");
radio.begin();
radio.setDataRate( RF24_250KBPS );
radio.setRetries(3, 5); // delay, count 3, 5
radio.setPALevel(RF24_PA_MIN);
radio.openWritingPipe(slaveAddress);
}
void loop()
{
currentMillis = millis();
if (currentMillis - prevMillis >= txIntervalMillis)
{
send();
prevMillis = millis();
}
}
void send()
{
static unsigned long txCount = 0;
static unsigned long failureCount = 0;
bool rslt;
rslt = radio.write( &numberToSend, sizeof(numberToSend) );
txCount++;
Serial.print("Data Sent ");
Serial.print(numberToSend);
if (rslt)
{
Serial.print(" Ack received");
numberToSend++;
}
else
{
failureCount++;
Serial.print(" Tx failed");
}
report(txCount, failureCount);
}
//================
void report(unsigned long tx, unsigned long fails)
{
Serial.print(" transmissions/failures ");
Serial.print(tx);
Serial.print("/");
Serial.println(fails);
}
The examples are adapted from those in Simple nRF24L01+ 2.4GHz transceiver demo