Problem with NRF24L01+

hey every one
i need a program to NRF24l01+ one led and switch in transmitter side and one led and switch in receiver side and transmit and receive dat at a time… Pls Help this prog made by me but not working

TX:

#include <SPI.h>
#include “nRF24L01.h”
#include “RF24.h”
int msg[1];
int msg1[1];
RF24 radio(8,9);
const uint64_t pipe1 = 0xE8E8F0F0E1LL;
const uint64_t pipe = 0xC2C2C2C2C2;
int LED= 13;
int SW1= 6;
void setup(void)
{
Serial.begin(9600);
pinMode(SW1, INPUT);
pinMode(LED, OUTPUT);
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe);
radio.openReadingPipe(1,pipe);
radio.startListening();

}
void loop(void)
{
if (radio.available()){
bool done = false;
while (done)
{
radio.read(msg1, 1);
if (msg1[0] == 222)
{
delay(10);
digitalWrite(LED, HIGH);
}
else if (digitalRead(SW1) == HIGH)
{
msg[0] = 111;
radio.write(msg, 1);
}
else
{digitalWrite(LED, LOW);}
delay(10);}}
}

RX:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
int msg[1];
int msg1[1];
RF24 radio(8,9);
const uint64_t pipe = 0xE8E8F0F0E1LL;
const uint64_t pipe1 = 0xC2C2C2C2C2;
int LED1 = 13;
int SW2= 5;
void setup(void){
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe);
radio.openReadingPipe(1,pipe);
radio.startListening();
pinMode(LED1, OUTPUT);
pinMode(SW2, INPUT);
}
void loop(void)
{
if (radio.available()){
bool done = false;
while (done)
{
radio.read(msg, 1);
if (msg[0] == 111)
{
delay(10);
digitalWrite(LED1, HIGH);
}
else if (digitalRead(SW2) == HIGH)
{
msg1[0] = 222;
radio.write(msg1, 1);
}

else
{
digitalWrite(LED1, LOW);}
delay(10);}}}

Maybe make msg1 & msg 32 bytes long and read and write the whole 32 bytes
I believe the payload is set to 32 by default

radio.write(buff, 32)
radio.read(buff, 32) etc

This seems to be the Nth place where you have asked this question. Please don't make multiple Posts about the same problem.

I got my nRF24s working with this Tutorial

I suggest you use the TMRh20 version of the RF24 library - it solves some problems from the ManiacBug version

The pair of programs in this link may be useful.

...R

Please don't make multiple Posts about the same problem.

AND also in my personal (and unrelated) facebook group, which I wasnt too happy about :frowning:

For multiple cross-posts and thread hijacks, the OP is now enjoying a forum time-out.