user26275: There are three Arduinos on a model. Each of them has a DS18B20 Dallas temperature sensor and an nRF24L01 antenna wireless communication. There is also an independent device consisting of an Arduino and an nRF24L01 antenna. Device acts as a receiver. Arduino and antenna play the role of transmitter. The code is:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Wire.h>

int temp1;
int WindSpeed;
int temp2;
int temp3;
RF24 radio(7, 8);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL};
void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.setRetries(15, 15);
  radio.setDataRate(RF24_250KBPS); 
  radio.openReadingPipe(0, pipes[1]);
  radio.openReadingPipe(1, pipes[2]);
  radio.openReadingPipe(2, pipes[3]);
  radio.startListening();
}

void loop() {
  if (radio.available()) {
    radio.read(&temp1, sizeof(temp1));  
     Serial.println("Temp1:");
     Serial.println(temp1);
     delay(50);
     radio.read(&WindSpeed, sizeof(WindSpeed));
     Serial.println(" WindSpeed Bf : ");
     Serial.println(WindSpeed);  
     delay(50);
     radio.read(&temp2, sizeof(temp2));
     Serial.println("temp2:");
     Serial.println(temp2);
     delay(50);
     radio.read(&temp3, sizeof(temp3));      
     Serial.println("temp3:");
     Serial.println(temp3);
     delay(50);
  } else {
    Serial.println("No radio Data avaliable");
  }
  delay(3000);
}

The problem is that the code sends some values but the correspondence isn't right in AnalogRead. How can I watch each pipe with the antenna of corresponding Arduino in order to have the right results, and each Arduino sends to the receiver through its own antenna the value of its sensor?
Thanks all for your time!

user612: You appear to be using the multiple pipes of the nrf24L01 to keep your data feeds distinct, and to be asking how you can differentiate the pipes on receive.
It's not clear which exact RF24 library you are using, but if you look at the headers of a typical one you will find something like:
  /**
   * Test whether there are bytes available to be read
   *
   * Use this version to discover on which pipe the message
   * arrived.
   *
   * @param[out] pipe_num Which pipe has the payload available
   * @return True if there is a payload available, false if none is
   */
  bool available(uint8_t* pipe_num);

Additionally, you do not want to use any delays in receiving code, as that could cause you to miss transmissions - if you use delays for pacing, they should be on the transmit side.
It's not clear if you have 3 or 4 pipes (and in your setup you have forgotten that C/C++ array indexing starts at 0 not 1) but to read 3 of potentially 4, you could do something like:
#define INTERVAL_MS 10000
unsigned long lastMsg = 0;
int values[4];
char *pipeNames[] = {"Temp1:", " WindSpeed Bf : ", "temp2:", "temp3"}; 
void loop() {
   uint8_t pipe;         
   if (radio.available(&pipe) {
     if (pipe < 3) {
        radio.read(&values[pipe], sizeof(int));
        Serial.println(pipeNames[pipe]);
        Serial.println(values[pipe]);
        lastMsg = millis();
     }
     else radio.flush_rx(); //unclear if this is needed to allow new data on a pipe that is of interest
   }
   /* warning - may mis-operate after ~50 days */
   if ((millis() - lastMsg) > INTERVAL_MS) {
      Serial.println("no data received in past 10 seconds");
      lastMsg = millis();
   }
}


26275: <p>There are three Arduinos on a model. Each of them has a DS18B20 Dallas temperature sensor and an nRF24L01 antenna wireless communication. There is also an independent device consisting of an Arduino and an nRF24L01 antenna. Device acts as a receiver. Arduino and antenna play the role of transmitter. The code is:</p>

<pre><code>#include &lt;SPI.h&gt;
#include &lt;nRF24L01.h&gt;
#include &lt;RF24.h&gt;
#include &lt;Wire.h&gt;

int temp1;
int WindSpeed;
int temp2;
int temp3;
RF24 radio(7, 8);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL};
void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.setRetries(15, 15);
  radio.setDataRate(RF24_250KBPS); 
  radio.openReadingPipe(0, pipes[1]);
  radio.openReadingPipe(1, pipes[2]);
  radio.openReadingPipe(2, pipes[3]);
  radio.startListening();
}

void loop() {
  if (radio.available()) {
    radio.read(&amp;temp1, sizeof(temp1));  
     Serial.println("Temp1:");
     Serial.println(temp1);
     delay(50);
     radio.read(&amp;WindSpeed, sizeof(WindSpeed));
     Serial.println(" WindSpeed Bf : ");
     Serial.println(WindSpeed);  
     delay(50);
     radio.read(&amp;temp2, sizeof(temp2));
     Serial.println("temp2:");
     Serial.println(temp2);
     delay(50);
     radio.read(&amp;temp3, sizeof(temp3));      
     Serial.println("temp3:");
     Serial.println(temp3);
     delay(50);
  } else {
    Serial.println("No radio Data avaliable");
  }
  delay(3000);
}
</code></pre>

<p>The problem is that the code sends some values but the correspondence isn't right in <code>AnalogRead</code>. How can I watch each pipe with the antenna of corresponding Arduino in order to have the right results, and each Arduino sends to the receiver through its own antenna the value of its sensor?</p>

<p>Thanks all for your time!</p>
 612: <p>You appear to be using the multiple pipes of the nrf24L01 to keep your data feeds distinct, and to be asking how you can differentiate the pipes on receive.</p>

<p>It's not clear <em>which</em> exact <code>RF24</code> library you are using, but if you look at the headers of a <a href="https://github.com/maniacbug/RF24/blob/master/RF24.h" rel="nofollow noreferrer">typical</a> one you will find something like:</p>

<pre><code>  /**
   * Test whether there are bytes available to be read
   *
   * Use this version to discover on which pipe the message
   * arrived.
   *
   * @param[out] pipe_num Which pipe has the payload available
   * @return True if there is a payload available, false if none is
   */
  bool available(uint8_t* pipe_num);
</code></pre>

<p>Additionally, you do not want to use any delays in receiving code, as that could cause you to miss transmissions - if you use delays for pacing, they should be on the transmit side.</p>

<p>It's not clear if you have 3 or 4 pipes (<strong>and in your setup you have forgotten that C/C++ array indexing starts at 0 not 1</strong>) but to read 3 of potentially 4, you could do something like:</p>

<pre><code>#define INTERVAL_MS 10000
unsigned long lastMsg = 0;
int values[4];
char *pipeNames[] = {"Temp1:", " WindSpeed Bf : ", "temp2:", "temp3"}; 
void loop() {
   uint8_t pipe;         
   if (radio.available(&amp;pipe) {
     if (pipe &lt; 3) {
        radio.read(&amp;values[pipe], sizeof(int));
        Serial.println(pipeNames[pipe]);
        Serial.println(values[pipe]);
        lastMsg = millis();
     }
     else radio.flush_rx(); //unclear if this is needed to allow new data on a pipe that is of interest
   }
   /* warning - may mis-operate after ~50 days */
   if ((millis() - lastMsg) &gt; INTERVAL_MS) {
      Serial.println("no data received in past 10 seconds");
      lastMsg = millis();
   }
}
</code></pre>
