Loop program stops on sending msg section ( using - nRF24L01)

Hello,

Its my first question after reading a loot around Arduino and playing around. I made some line fallow'er robot, some IR control LED light and electric engines. Everything is leading to some smart house stuff, so i came to point of wireless communication more reliably then IR and two way without seeing each other. There comes nRF24L01, i read about it. I buy few of them, i follow few tutorials and never make it work. Frustrating.

Im just following another tutorial and i try to turn on LED on arduino UNO with another arduino UNO. One have LED and other have Button.

Im working on transmitter at the moment and i have issue with it. I have some doubts if its actually sending anything. (how i can check if i have no idea if receiver is working).

So i came up with idea to put to existing code additional Serial.println ("hello world") so i can see that after i push button it works. And was just fine, but "hello world" appeared just once, and its not how loop should work like.

So i add LED on transmiter (so i see that arduino is stil working when PC is connected to reciver), should go on when button is pushed but i place it on the end of loop with nRF24L01 related code in between. Didn't work.

Like this code:

msg[0] = 111;
 radio.write(msg, 1);

is stoping whole loop...

After i get rid of this piece of code everything go like it should by (loop is loopin and i get as many "hello world" as i press button, and led go on and off like it should). I even add small code to turn LED off it button is not pressed.

Like i said, whole thing is based on tutorial so i don't entirely know how this things can work other way. Other tutorials end up bad too with this transmitters... (i have 6 of them so i swap them to, so im almost sure its not hardware problem)

I post code for Transmiter below:

#include  <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int msg[1];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int SW1 = 2;


void setup()
{
 Serial.begin(9600);
 radio.begin();
 radio.openWritingPipe(pipe);
 pinMode(2, INPUT);
 digitalWrite(2, HIGH);
 pinMode(4, OUTPUT);
}

void loop()
{
 if (digitalRead(SW1) == LOW)

{
  Serial.println("Hello world.") ;
  digitalWrite(4, HIGH);
  delay(300);
  msg[0] = 111;
  radio.write(msg, 1);
}
 else 

 {
  digitalWrite(4, LOW);
 }
 

}

Please if any one have idea, please give a hint or a guide

Cheers,

Maciej