NRF24L01 - one sender - multiple receivers

hi guys,
after weeks of searching for a solution to my problem, one sender sending 1Hz signal to multiple receivers, i've settled with NRF24L01, amazing stuff.
Now, i do not understand a lot about the code and libraries used for NRF24L01 so i am kindly asking for any directions.

The code i have now is basically copy/paste and i am trying to understand how it works. Everything works great, i am using one NRF24L01 to send the signal and another to receive the signal and turn the LED ON/OFF based on received signal (HIGH/LOW).
Transmitter code:

//Robo India Tutorial on nRF24L01
//Simple Code for transmitter


#include <SPI.h>                            //Communication Interface with modem
#include "nRF24L01.h"
#include "RF24.h"                          //library to control radio modem
 
RF24 radio(9,10);                          //Creating an object

const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
unsigned long Command ;
void setup()
   {
    Serial.begin(57600);
    pinMode(4,INPUT);
    radio.begin();                        //activates modem
    radio.setRetries(15,15);              //number of times modem retry to send data
    radio.openReadingPipe(1,pipes[1]);
    radio.startListening();
    radio.printDetails();
    radio.openWritingPipe(pipes[0]);     //sets address to recevier
    radio.openReadingPipe(1,pipes[1]);
    radio.stopListening();               //switch the modem to data transmission mode
   }
 
  void loop(void)
   {
    radio.stopListening();
    if (digitalRead(4)==1){
    Command=1;
   }
    else
      {
        Command=2;
      }
    radio.write( &Command, sizeof(unsigned long) );  //blocks the program until it receives the acknowledgment
    radio.startListening();
    
  }

Receiver code:

//Robo India Tutorial on nRF24L01
//Simple Code for Receiver


#include <SPI.h>                           //Communication Interface with modem
#include "nRF24L01.h"
#include "RF24.h"                          //library to control radio modem
 
RF24 radio(9,10);                          //Creating an object

const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
typedef enum { role_ping_out = 1, role_pong_back } role_e;
const char* role_friendly_name[] = { "invalid", "Ping out", "Pong back"};
 
role_e role = role_pong_back;

void setup(void)
   {
    Serial.begin(57600);
    pinMode(4,OUTPUT);
    radio.begin();                         //activates modem
    radio.setRetries(15,15);
    radio.openReadingPipe(1,pipes[1]);
    radio.startListening();
    radio.printDetails();
    radio.openWritingPipe(pipes[1]);
    radio.openReadingPipe(1,pipes[0]);
    radio.startListening();
   }
 
 void loop(void)
   {
    if ( radio.available() )               //check receive data
       {
          unsigned long data = 0;
          radio.read( &data, sizeof(unsigned long) );
          Serial.println(data);
             if (data==1)
                  {
                    digitalWrite(4,HIGH);
                  }
            else
                  {
                    digitalWrite(4,LOW);
                  }
 
  delay(20);
       }
    }

Now, my main focus is signal latency. when i have one receiver connected i have <1ms latency. as soon as i connect one more receiver with identical code i get 2-3ms latency on both, i guess this has to do with using the same code for receiver and having only two "pipes" whatever that may be.

So my question is, if someone would help me understand few things:

  1. I do not really understand the format of the address of my devices "0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL"... can i just add new addresses with arbitrary values like "0xF0F0F0F0C3LL, 0xF0F0F0F0D3LL... as long as they follow the same format?
  2. If i got it right, i can have 6 deices as receivers using 6 pipes?
  3. basically related to 1 & 2 from above, how do i add more devices on more pipes and would that keep my latency down?

Many thanks in advance,
Alek

P.S. Hate the new forum!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.