NRF24L01 - only works when I flash an LED

I’m ever so confused!

I’ve been playing with an NRF24L01 - following tutorials on the web and that. I almost thought I had it when I realised I’d wired the receiver up the wrong way around (Doh!)

Below is the receiver code. When I run it like this I get nothing out of the serial monitor. But if I uncomment the LED outputs (second to last two lines) it works - I get a “HIGH” until I press the button on the transmitter, at which point I get a low. I just can’t figure out why a blip on the LED should make the difference!

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

int msg[1] = {000};

RF24 radio(5,10);

const uint64_t pipe = 0xE8E8F0F0E1LL;

void setup() {
  radio.begin();
  radio.openReadingPipe(1,pipe);
  radio.startListening();
  Serial.begin(9600);
  pinMode(7, OUTPUT);
}

void loop() {
  while (radio.available()) {
      radio.read(msg,1);
      if (msg[0] == 111) { //switch is pressed
        Serial.println("HIGH");
      } else {
        Serial.println("LOW");
      }

  }
  delay(10);
  //digitalWrite(7,HIGH);delay(25);
  //digitalWrite(7,LOW);delay(25);
}

Receiver hardware is a nano. for sake of completeness:
GND → both GND on breadboard
5v to 5v rail on breadboard
NRF 5v/gnd to breadboard 5v/gnd
CE to D5
CS to D10
SCK to D13
MO to D11
MI to D12
and LED directly between D7 and GND (I know it should have a resistor, but it’s 5v and I can sacrifice a bit of LED life for a quick test!

letters above might be a bit off, I think that’s whay they say on the NRF24L01 but my eyes are tired!

Further: putting just the HIGH write in at the bottom and it works (LED on all the time), putting the LOW write on and there's nothing...

Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to.

A common problem with nRF24 modules is insufficient 3.3v current from the Arduino 3.3v pin. The high-power nRF24s (with the external antenna) will definitely need an external power supply. At least for testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

If you are using the high-power nRF24s (with the external antenna) make sure there is sufficient distance between the two nRF24s so that the signal does not overwhelm the receiver - try 3 metres separation. If you are new to nRF24s it may be better to start with a pair of low power modules with the pcb antenna.

...R