nRF4L01 receiving problem

Hello all, first time poster.
I have been working on a project where I require to send data from Accelerometre specifically ADXL335 from one Arduino to another using nRF24L01 transmitter and receiver.
I can easily transmit data, but data would not get received on other side. I have tried and both Arduinos are working as transmitters, but not as receivers.

I am attaching transmitter and receiver code.

**Transmitter Code. **

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

RF24 radio(9,10);
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

float sent;
int xpin = A4;
int ypin = A3;
int zpin = A2;
int Vcc = A5;
int gnd = A1;

float valx[100] = {0};
float valy[100] = {0};
float valz[100] = {0};

float avgx,avgy,avgz;

float A, Ax, Ay,Az;

#define v_ref 5
// zero g value of the 3 axis from data sheet
#define zero_x 1.5
#define zero_y 1.5
#define zero_z 1.5
// sensitivity of three axis from data sheet
#define sen_x 0.3
#define sen_y 0.3
#define sen_z 0.3
//int SW = 7;

void setup()
{
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1,pipes[1]);
radio.startListening();
pinMode(Vcc, OUTPUT);
pinMode(gnd, OUTPUT);
digitalWrite(Vcc, HIGH);
digitalWrite(gnd, LOW);
}

void loop()
{

sent = accelero();
Serial.print("Sent value= ");
Serial.println(sent);
radio.startListening();
radio.write(&sent,sizeof(unsigned long));
delay(500);

}

float accelero()
{
float sum = 0;
float sum1 = 0;
float sum2 = 0;
for (int i = 0; i < 100; i++)
{
valx = float(analogRead(xpin));
_ sum = valx + sum;_
* }*
* avgx = sum / 100.0;*
* for (int j = 0; j < 100; j++)*
* {*
* valy[j] = float(analogRead(ypin));*
* sum1 = valy[j] + sum1;*
* }*
* avgy = sum1 / 100.0;*
* for (int k = 0; k < 100; k++)*
* {*
* valz[k] = float(analogRead(zpin));*
* sum2 = valz[k] + sum2;*
* }*
* avgz = sum2 / 100.0;*

Ax= ((avgxv_ref/1023)-zero_x)/ sen_x;
Ay= ((avgyv_ref/1023)-zero_y)/ sen_y;

Az= ((avgzv_ref/1023)-zero_z)/ sen_z;
_ A= sqrt (AxAx+AyAy+AzAz);
* return A;*
}
Receiver code._

#include <SPI.h>
#include “nRF24L01.h”
#include “RF24.h”
#include “RF24_config.h”
float vector;
RF24 radio(9,10);
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
//int LED=3;
void setup(void)
{
Serial.begin(9600);
pinMode(LED, OUTPUT);
radio.begin();
radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1,pipes[0]);
radio.startListening();
}
void loop(void)
{
* if (radio.available())*
* {*
* bool done = false; *
* while (!done)*
* {*
* done = radio.read(&vector, sizeof(unsigned long));*
* Serial.print("rcvd value= ");*
* Serial.println(vector);*
* }*
* }*
}

Please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum Your code is too long to study quickly without copying to a text editor.

How do you know the transmitters are working properly unless you can receive the data?

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