serial.print causes reset in combination with RF24 radio

Today i got a strange issue while programming an Arduino with RF24 Radio.

I was using Serial.print in the main loop to debug code. Found that whenever the command was used and after that a new Serial.print command was given the arduino completely resets.

Have tried everything, other arduino, new radio module, delay before Serial.print, etc.

I know for sure that the radio is receiving information correctly. I have sent several values from an other radio module and one of them should make pin 5 high. That happend correctly. When pasting the code that make pin 5 high behind the Serial.print line nothing happend. (i deleted that part of pin 5 in my example code)

What i want is that the arduino can Serial.print the received intensity values so i can read them. It’s that simple…

Hope you can help me out,
Thanks in advance!

//----------------------------------------------------- LIBRARY CODE -----------------------------------------------------\\
#include <SPI.h>
#include "RF24.h"

//----------------------------------------------------- LIBRARY CODE -----------------------------------------------------\\

RF24 radio(7,8);
byte addresses[][6] = {"1Node","2Node"};

int intensity = 0;

void setup() {
  Serial.println("Setup reset");

  radio.setPALevel(RF24_PA_LOW);                                    // Set the PA Level MAX (>250m)
  radio.openWritingPipe(addresses[1]);                              // Open communication Pipe 1
  radio.openReadingPipe(1,addresses[1]);                            // Listen on communication Pipe 1
  radio.openReadingPipe(2,addresses[0]);                            // Listen on communication Pipe 2

void loop() {
    while(radio.available()) { &intensity, sizeof(unsigned long) );
    Serial.print("Hello World");

Set pin 10 as an output. If it is not connected to anything then noise (possibly radiated from the serial output) can put your Arduino into SPI receive mode.

If this doesn't work, let us know where you got rf24.h from. A quick google search shows there are at least two versions out there.

Thanks for your reply!

I will check it monday

This looks a bit fishy &intensity, sizeof(unsigned long)

considering that intensity is an int.

My guess is that your code is saving the incoming data in places it has no business being.

It should be &intensity, sizeof(intensity)

I got my nRF24s working with this Tutorial

The pair of programs in this link may be useful.

They require the TMRh20 version of the RF24 library which solves some problems from the earlier ManiacBug version


First of all, thanks Robin2 and MorganS for replying.

The real issue was my wrong declaration of intensity. I made it an unsigned long instead of an integer and the problem was fixed.

Set pin 10 as output shows no difference but I've done it to prevent any disruptions in the future.

Thanks for helping me out!