When i connect my 4th sensor in the analog pin in Arduino Mega for transmit the voltage data to the receiver side through nRF24L01+, then only 3 sensor data shown in the serial monitor of the Receiving side and the 4th sensor displayed 0 voltage. Plz help me in this regard. I attach the code and the Transmitter and receiver side output.
//Transmitter Part
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define HallVolt1 A0
#define HallVolt2 A1
#define HallVolt3 A2
#define HallVolt4 A3
float hall1 = 0.0;
float hall2 = 0.0;
float hall3 = 0.0;
float hall4 = 0.0;
RF24 radio(2,3);
const byte rxAddr[6] = "00001";
void setup() {
Serial.begin(9600);
radio.begin();
radio.setRetries (15, 15);
radio.openWritingPipe (rxAddr);
radio.setPayloadSize (32);
radio.stopListening ();
}
void loop() {
hall1 = analogRead (HallVolt1);
hall2 = analogRead (HallVolt2);
hall3 = analogRead (HallVolt3);
hall4 = analogRead (HallVolt4);
hall1=hall1*5/1023;
hall2=hall2*5/1023;
hall3=hall3*5/1023;
hall4=hall4*5/1023;
Serial.print("Transmite Hall-1 Effect = ");
Serial.print(hall1);
Serial.print("Volt");
Serial.print("\t");
Serial.print("Transmite Hall-2 Effect = ");
Serial.print(hall2);
Serial.print("Volt");
Serial.print("\t");
Serial.print("Transmite Hall-3 Effect = ");
Serial.print(hall3);
Serial.print("Volt");
Serial.print("\t");
Serial.print("Transmite Hall-4 Effect = ");
Serial.print(hall4);
Serial.print("Volt");
Serial.print("\t");
Serial.println();
radio.write(&hall1, sizeof(hall1));
radio.write(&hall2, sizeof(hall2));
radio.write(&hall3, sizeof(hall3));
radio.write(&hall4, sizeof(hall4));
delay(1000);
}
//Receiver Part
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
float hall1 = 0.0;
float hall2 = 0.0;
float hall3 = 0.0;
float hall4 = 0.0;
RF24 radio(2,3);
const byte rxAddr[6] = "00001";
void setup() {
while (!Serial);
Serial.begin (9600);
radio.begin();
radio.setPayloadSize(32);
radio.openReadingPipe(0, rxAddr);
radio.startListening();
}
void loop() {
if (radio.available()){
radio.read(&hall1, sizeof(hall1));
radio.read(&hall2, sizeof(hall2));
radio.read(&hall3, sizeof(hall3));
radio.read(&hall4, sizeof(hall4));
Serial.print(" Received Hall-1 Effect. = ");
Serial.print(hall1);
Serial.print("Volt");
Serial.print("\t");
Serial.print(" Received Hall-2 Effect. = ");
Serial.print(hall2);
Serial.print("Volt");
Serial.print("\t");
Serial.print(" Received Hall-3 Effect. = ");
Serial.print(hall3);
Serial.print("Volt");
Serial.print("\t");
Serial.print(" Received Hall-4 Effect. = ");
Serial.print(hall4);
Serial.print("Volt");
Serial.print("\t");
Serial.println();
}
delay (1000);
}

