NRF24L01+ modules not working.

Hi I am a beginner to Arduino and I have a problem that has been driving me crazy for several days. I have two NRF24L01+ modules and I am planning on using them to make an RC car but for now I am trying to learn how they work by making a simple project where I have two Arduino Nano’s, each attached to a module one of them has an Analog Joystick attached to the Analog 0 pin. The other Arduino has an LED attached to Digital pin 5. Here is my code.

Transmitter

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

RF24 radio(7, 8); // CE, CSN
const byte address = "00001";
void setup(){
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
  Serial.begin(9600);
}
void loop(){
  int potValue = analogRead(A0);
  int angleValue = map(potValue, 0, 1023, 0, 255);
  radio.write(&angleValue, sizeof(angleValue));
  Serial.println(angleValue);
  analogWrite(3, angleValue);
}
Receiver
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(0, address); // 00001
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
}
void loop() {
  if ( radio.available()) {
    while (radio.available()) {
      int angleValue = 0;
      radio.read(&angleValue, sizeof(angleValue));
      Serial.println(angleValue);
      analogWrite(5, angleValue);
    }
  }
}

When I upload and run the code the Serial Monitor part is working perfectly, it shows numbers from 0 to 255 depending on the Joystick’s position, but the LED is always dark.
Any help will be much appreciated.
Thank you in advance.

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. This seems to be a particular problem with nanos. 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.

...R