nRF24L01 is not sending data

Hello!
I´m having troubles with two nRF24L01+, I’ve tried some different programs and I have the same error (it’s not sending data). I have an Arduino UNO and a Mega. I’ve checked the connections of each arduino, because the pin connection are different. I also swiched the 2 devices and i have the same problem.
This is one of the programs i’ve tried:

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

//Declaremos los pines CE y el CSN
#define CE_PIN 9
#define CSN_PIN 10

//Variable con la dirección del canal por donde se va a transmitir
byte direccion[5] ={‘c’,‘a’,‘n’,‘a’,‘l’};

//creamos el objeto radio (NRF24L01)
RF24 radio(CE_PIN, CSN_PIN);

//vector con los datos a enviar
float datos[3];

void setup()
{
//inicializamos el NRF24L01
radio.begin();
//inicializamos el puerto serie
Serial.begin(9600);

//Abrimos un canal de escritura
radio.openWritingPipe(direccion);

}

void loop()
{
radio.stopListening();
//cargamos los datos en la variable datos
datos[0]=3;
datos[1]=millis();
datos[2]=3.14;
//enviamos los datos
bool ok = radio.write(&datos, sizeof(datos));
//reportamos por el puerto serial los datos enviados
if(ok)
{
Serial.print("Datos enviados: “);
Serial.print(datos[0]);
Serial.print(” , “);
Serial.print(datos[1]);
Serial.print(” , ");
Serial.println(datos[2]);
}
else
{
Serial.println(“no se ha podido enviar”);
}
delay(1000);
}

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//Declaremos los pines CE y el CSN
#define CE_PIN 9
#define CSN_PIN 10
//Variable con la dirección del canal que se va a leer
byte direccion[5] ={‘c’,‘a’,‘n’,‘a’,‘l’};

//creamos el objeto radio (NRF24L01)
RF24 radio(CE_PIN, CSN_PIN);

//vector para los datos recibidos
float datos[3];
void setup()
{
//inicializamos el NRF24L01
radio.begin();
//inicializamos el puerto serie
Serial.begin(9600);

//Abrimos el canal de Lectura
radio.openReadingPipe(1, direccion);
//empezamos a escuchar por el canal
radio.startListening();
}
void loop() {
uint8_t numero_canal;
//if ( radio.available(&numero_canal) )
if ( radio.available() )
{
//Leemos los datos y los guardamos en la variable datos
radio.read(&datos,sizeof(datos));

//reportamos por el puerto serial los datos recibidos
Serial.print(“Dato0= " );
Serial.print(datos[0]);
Serial.print(” V, ");
Serial.print(“Dato1= " );
Serial.print(datos[1]);
Serial.print(” ms, ");
Serial.print("Dato2= " );
Serial.println(datos[2]);
}
else {
Serial.println(“No hay datos de radio disponibles”);
}
delay(1000);
}

I,ve run this other code and i got this info (results are on the images)

#include “nRF24L01.h”
#include “RF24.h”
#include “printf.h”

RF24 radio(9,10); // CE, CSN

const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
typedef enum { role_ping_out = 1, role_pong_back } role_e;
const char* role_friendly_name = { “invalid”, “Ping out”, “Pong back”};

role_e role = role_pong_back;

void setup(void) {

Serial.begin(9600);
printf_begin();
radio.begin();
radio.setRetries(15,15);
radio.openReadingPipe(1,pipes[1]);
radio.startListening();
radio.printDetails();
}
void loop(void){
}

I hope you can help me understanding all this :slight_smile: Thank you!

If you have a pair of nRF24s and data is not being received you have no means to know whether the problem is in the sender or the receiver.

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. 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

you should buy nrf24l01 breakout boards and then connect 5v from your arduinos to the breakout board's vcc, thats what made it work for me