nrf24l01+ radio.write() FAILS (and can't figure out why) =(

Hi everybody,

I’ve spent a lot of time trying to use two nrf24l01+ modules to create a wireless sensor network.

My intent is to send humidity and temperature from a DHT11 sensor to a reciever placed in another room.

Tried a lot of examples found on the web, but without luck … only the example pingpair.pde of the RF24 class worked once.

I found this code on RF24 library revisited , and modified it a bit to meet my project but is still not working and I cannot figure out why

The code of sender is:

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include <dht11.h>
dht11 DHT;
#define DHT11_PIN 4
int data[2];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
bool success;
void setup(void)
  //Check sensor once starting 
  int chk;
  Serial.print("DHT11, \t");
  chk =;    // READ DATA
  switch (chk){
    case DHTLIB_OK:  
                Serial.print("Checksum error,\t"); 
                Serial.print("Time out error,\t"); 
                Serial.print("Unknown error,\t"); 
void loop(void)
  data[0] = DHT.humidity;
  Serial.print(" , ");
  data[1] = DHT.temperature;
  success = radio.write( data, sizeof(data) );
    case true:
    case false:

The problem is that function radio.write() fails instead of succeding, wich means that the message was not sended !

Someone can help me ?

Thanks in advance

Its been a while since I used the RF24 stuff, but I'd check the return values from


Also. Generally don't both using a switch statement when you only have 2 results ie true or false

And you don't need to waste a variable to store it, if you are not using that response later

  if (radio.write( data, sizeof(data) ){

Hi Roger, thanks for your help.

Unfortunately radio.begin() and radio,openWritigPipe() are void functions, so do not returns anything ... how can I test them ?
(sorry for the question, I'm not an experienced programmer)