nRF24L01+ and Arduino power cycle issue


I am trying to build remote control with nRF24L01+, everything works just perfect but when I unplug power and plug it again sketch doesn't start, actually radio.write() function doesn't send message to my second Arduino unit but when I press reset button It is working. That is very annoing and in this case my remote control is useless.

I am using RF24 maniacbug library.

Code, almost the same on both units, the only difference is in "writing/reading pipe".

const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
RF24 radio(6, 7);

const int COMMAND = 111;

void setup() {

  radio.setRetries(15, 15);

  radio.openReadingPipe(1, pipes[0]);


  if (radio.write(&COMMAND, sizeof(int)))


void loop() {
  if (radio.available()) {
    bool done = false;
    while (!done) {
      int packet;
      done =, sizeof(int));

      Serial.print("data: ");

I hope that someone know how to resolve this annoying issue, thanks.

I have not had the problem you describe but I have had the opposite problem - where the nRF24 does not reset when the Arduino reset button is pressed.

It may be worth trying the TMRh20 version of the RF24 library which solves some problems from the earlier ManiacBug version. Note that TMRh20 uses the same name for his library which can cause confusion.

It looks like you only transmit a message once from setup(). That can be prone to failure if there is any radio interference. I would never assume that a single message will get through.

This Simple nRF24L01+ Tutorial may be helpful.

I suggest you change this

radio.write(&COMMAND, sizeof(int))

to the more general

radio.write(&COMMAND, sizeof(COMMAND))

as it will continue to work properly if you change the definition of COMMAND


It seems that radio.write() function fails when I power cycle Arduino so I found very ugly solution:

void(* resetFunction) (void) = 0;

// now in setup() I have something like this:
bool result = radio.write(&COMMAND, sizeof(int));
if (!result) {

And this works but I think that's bad workaround.

I wonder if you just need a short delay() in setup() before you call radio.write(). Maybe the nRF24 takes longer to get started than the Arduino.


I tried delay() before but didn't work.

Have you tried the newer TMRh20 version of the RF24 library?