NRF24L01 Problem , check my code please

hi ,
i make this code ( transmitter , reciever ) and i don't know why it's not working , i fllow all the Step in this link : https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo#lib , but it's still not working .
can someone help me ?

Transmitter Code :
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include <printf.h>

int data ;
RF24 radio (9, 10);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL };

void setup(void) {
Serial.begin(9600);
printf_begin();
data =100 ;
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MAX);
radio.openWritingPipe(pipes[1]);
radio.startListening();
radio.printDetails();

}

void loop(void)
{
radio.write(&data, sizeof(data));
Serial.println(data);
data= data +1 ;
delay(10);
}

Reciever Code :

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

int data ;

RF24 radio(9, 10);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL };

void setup(void) {
Serial.begin(9600);
radio.begin();
printf_begin();

radio.setDataRate(RF24_250KBPS);
radio.openReadingPipe(1, pipes[1]);
radio.startListening();
radio.setPALevel(RF24_PA_MAX);
radio.printDetails();

}

void loop(void)
{
if ( radio.available() )
{
delay(50);
radio.read(&data, sizeof(data));
Serial.println(data);
}else
{
Serial.println("No radio available");
}
delay(1000);

transmitter.ino (524 Bytes)

reciever.ino (587 Bytes)

Can you please just post the code?

Did you add extra decoupling caps to the radios?

I already posted it and and i didn't add extra decoupling caps to the radios

(deleted)

Eric99:
I already posted it and and i didn't add extra decoupling caps to the radios

No, you attached it, which means people have to download code, then open it in an appropriate app, which on mobile devices can be something of a trial.

Code tags would've been nice :frowning:

I suggest you change the delay in the transmitter code to 1000 and remove the delay(50) in the receiver code and change the delay(1000) to delay(300).

That way it listens more than it speaks - which is usually a good strategy.

The pair of programs in this link may be useful.

...R

Hi,
Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Thanks.. Tom.. :slight_smile:

thank you all for your replies , i will try again with your advices and i hope it will works , and here are my codes

Trasnmitter code :

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


int data ;
RF24 radio (9, 10);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL };

void setup(void) {
Serial.begin(9600);
printf_begin();
data =100 ;
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MAX); 
radio.openWritingPipe(pipes[1]);
radio.startListening();
radio.printDetails();


}

void loop(void)
{
radio.write(&data, sizeof(data));
Serial.println(data);
data= data +1 ;
delay(10);
}

reciever Code :

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



int data ;

RF24 radio(9, 10);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL };

void setup(void) {
Serial.begin(9600);
radio.begin();
printf_begin();

radio.setDataRate(RF24_250KBPS);
radio.openReadingPipe(1, pipes[1]);
radio.startListening();
radio.setPALevel(RF24_PA_MAX); 
radio.printDetails();

}

void loop(void)
{
if ( radio.available() )
{
delay(50);
radio.read(&data, sizeof(data));
Serial.println(data);
}else
{
Serial.println("No radio available");
}
delay(1000);
}

Eric99:
i will try again with your advices and i hope it will works

Let us know.

There is no need for us to look at working code :slight_smile:

...R