RX cannot receiver data from other 2 TX via nRF24l01 code

Hi all, request help to troubleshoot my coding. My setup of the project is (Rx with Uno+nRF24l01+ENC28j60) +(TX1 with Uno+nRF24l01+DHT11+CK-003) +(TX2 with Nano+nRF24l01+LDR).
Current stage is, RX able to data from TX1 or TX2 only. I having problem with the 2 TX sending data to RX.
As i am not good in programing i try to copy and merge most of the coding that i can find , but i still unable to get the RX to receive data from both TX at the same time.
i Request alot of help on amending the nrf24l01 pipe portion if possible…

From RX code

#include <SPI.h>
#include <EtherCard.h>
#include <nRF24L01.h>
#include <RF24.h>

#define CE_PIN   9
#define CSN_PIN 8
const uint64_t pipe[2]= {0xE8E8F0F0E1LL,0xF0F0F0F0D2LL}; 

RF24 radio(CE_PIN, CSN_PIN); 

static byte mymac[] = { 0x00,0x01,0x02,0x03,0x04,0x6E };
static byte myip[] = { 172,16,156,25};
static byte gwip[] = {172,16,156,254 };

byte Ethernet::buffer[1000];

BufferFiller bfill;

int nanoTxReading[2];
int nanoL=0;

int reading[3]; 
int t=0; //that’s a variable to store temperature values
int h=0; //that’s a variable to store humidity values
int l = 0;//that’s a variable to store LDR values
int Timer= 0;

void setup () 
{
  
  Serial.begin(9600);
  radio.begin();
  
  radio.openReadingPipe(1,pipe[0]);
  radio.openReadingPipe(2,pipe[1]);
  radio.startListening();
  
  if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)
  Serial.println( "Failed to access Ethernet controller");
  ether.staticSetup(myip, gwip);  
}

static void ReadValues()
{
 l=reading[0];
 t= reading[1];
 h= reading[2];
 
 nanoL=nanoTxReading[0];
 
}
static void ReadError()
{
     l=0;
     t= 0;
     h= 0;
     
  nanoL=0;   
}

void loop () {
  delay(100);
  if ( radio.available() )
  {
    bool done = false;
    while (!done)
    {
      
      done = radio.read( reading, sizeof(reading) );
    
      Serial.print("LDR1 = ");
      Serial.println(reading[0]);
      Serial.print("Temp = ");      
      Serial.println(reading[1]);
      Serial.print("Humi = ");      
      Serial.println(reading[2]);   
      Serial.print("Nano LDR = ");
      Serial.println(nanoTxReading[0]);
      ReadValues();
      Timer=0;     
    }
  }
  else
  {    
  
   Serial.println("No radio available");
  Timer +=1;
   }  
  
   Timer  = Timer+1;
  if(Timer==30)
  {
    ReadError(); 
    Timer=0;
  }
 
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
 // if (pos)  // check if valid tcp data is received
 //{
 
    ether.httpServerReply(homePage()); // send web page data
// }
 
}

//  Here we build a web page and pass the t and h values into it
static word homePage() {
      
      
   bfill = ether.tcpOffset();
    bfill.emit_p(PSTR(
   "HTTP/1.0 503 OK\r\r\r\r\n"                      
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n\n"                      
    "\r\n"                                         
    "<meta http-equiv='refresh' content='1'/>"    // refresh rate 5sec
    "<title><h2>Arduino TESTING</h2></title>"        //To change the Tab name
    "<body style='background-color:rgb(255,200,180);'>" // to change colour of the page
    "<h1 style='text-align: center;'><em><span style='color: rgb(153, 0, 0);'>This is a testing page for Arduino</span></em></h1>"
    "<h1> Arduino TESTING</h1>"                     // Add header 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  "<hr />"
  "<hr />"
  "<h1 style='text-align: center;'><b>Lab data<b></h3>"
  "<hr />"
  "<h2>Lab1 table: 
</h2>"
  "<h3>Temperature &nbsp; : $D C 
Humidity &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; :  $D %
Room light &nbsp&nbsp&nbsp&nbsp&nbsp; :  $D 
</h3><hr>"

  "<h2>Lab2 table: 
</h2>"
  "<h3>Room light &nbsp&nbsp&nbsp&nbsp&nbsp; :  $D 
</h3><hr>"
  ),t, h, l, nanoL  );

  return bfill.position();
}

From TX1 Code

/*-----( Import needed libraries )-----*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <DHT11.h>
#include <dht.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define CE_PIN   9
#define CSN_PIN 10
#define LDR A0
#define DHT A1
DHT11 dht11(DHT);

const uint64_t pipe = 0xE8E8F0F0E1LL; 

RF24 radio(CE_PIN, CSN_PIN); 

int reading[3];   
int LDRValue = 0;
int err;
float temp, humi;

void setup()   
{
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(pipe);
 
}

void loop() 
{
    reading[0] = analogRead(LDR);
    

     radio.write( reading, sizeof(reading) );
if((err=dht11.read(humi, temp))==0)
  {
    Serial.print("temperature:");
    Serial.print(temp);
    Serial.print(" humidity:");
    Serial.print(humi);
    Serial.println();
    
    
    char t = temp; 
    char h = humi;
   reading[1] = (t);
   reading[2] = (h);
   radio.write( reading, sizeof(reading) );
  }
  else
  {
    Serial.println();
    Serial.print("Error No :");
    Serial.print(err);
    Serial.println();       
  }
 
  Serial.print("LDR= ");   
  Serial.println(reading[0]);  
  Serial.print("Temp= ");  
  Serial.println(reading[1]);
  Serial.print("Humi= ");  
  Serial.println(reading[2]);

  
}

From TX2 Code

/*-----( Import needed libraries )-----*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define CE_PIN   9
#define CSN_PIN 10
#define LDR A0
const uint64_t pipe =0xF0F0F0F0D2LL ;
RF24 radio(CE_PIN, CSN_PIN); 

int nanoTxReading[1];   
int LDRValue = A0;

void setup()   
{
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(pipe);
 
}

void loop() 
{
  nanoTxReading[0] = analogRead(LDRValue);
    

  radio.write( nanoTxReading, sizeof(nanoTxReading) );
  Serial.print("Nano LDR= ");   
  Serial.println(nanoTxReading[0]);  
  
}

If you have one Rx and two Tx on the same frequency, you will have problems with interference between the Tx signals. Same as you trying to listen to one person in each ear.

You will need to come up with a system that they do not Tx together or use two Tx/Rx systems.

Weedpharma

is it possible to be a timing systems for each transmitter in alternate timing?

Only if you have two way communication to both Txs. Have the master request from each slave.

Weedpharma

As i am not good in programing i try to copy and merge most of the coding that i can find , but i still unable to get the RX to receive data from both TX at the same time.

If you literally mean "at the same time", well, you can't, it's impossible.

If you mean, your program will sometimes receive from one and sometimes from the other, then it should be possible ( as long as both transmitters don't transmit at the same time )

Thank you, i will try to have delay for each of the TX to send data. will see how it goes

does any 1 have other idea? or any sample code that i can merge and modify? i am still having problem with the coding. Had try to add in delay/ timer to staggered the timing of transmitting but it still wont work.

Try a big time difference to see if it is a code problem or radio problem. If they are Tx a couple of minutes apart, you should receive each one. If not your problem is somewhere else.

Weedpharma

Try getting the receiving Uno to request data from each of the others one at a time. That way you can have control over the process and as many transmitters as you like. I use that system for radio control for my model trains.

...R

weedpharma:
Try a big time difference to see if it is a code problem or radio problem. If they are Tx a couple of minutes apart, you should receive each one. If not your problem is somewhere else.

Weedpharma

If u mean bigger time difference, i tired it too. the receiver will not receiver anything . if the small difference, sometime will recieve TX1 or TX2. .

Robin2:
Try getting the receiving Uno to request data from each of the others one at a time. That way you can have control over the process and as many transmitters as you like. I use that system for radio control for my model trains.

…R

I haven try this way of requesting. Do you have a sample code to share with me?

mathew1989:
Do you have a sample code to share with me?

No, sorry. My code uses a different 2.4GHz transceiver.

But the idea is very simple. Give each “slave” a unique ID - for example const char myID = ‘A’; Then the master sends an ‘A’. All the slaves receive the ‘A’ but only the one with the ID of ‘A’ responds.

You can allocate the different IDs when you are uploading the program to the slave - just change that line in the code.

…R

mathew1989:
If u mean bigger time difference, i tired it too. the receiver will not receiver anything . if the small difference, sometime will recieve TX1 or TX2. .

This suggests a code fault.

If it works with only one Tx individually as you say in OP, if it fails with two Txs with big delay so they cannot overlap then there is a code problem.

Turn off Tx2 and try with Tx1. If it works, turn off Tx1 and try with Tx2.

If it does not work, go back to where you had one at a time working and start again.

Weedpharma

Hi all, i manage to solve the communication problem.
Right now, i wish to make my reading of declared integer l to be “OFF” /“ON” text, so that show the status in the web, instead of showing numbers. Please advice

#include <SPI.h>
#include <EtherCard.h>
#include <nRF24L01.h>
#include <RF24.h>

#define CE_PIN   9
#define CSN_PIN 8

const uint64_t pipes[6] = {0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL, 0xF0F0F0F0C3LL,0xF0F0F0F0C4LL,0xF0F0F0F0C5LL,0xF0F0F0F0C6LL };


RF24 radio(CE_PIN, CSN_PIN); 

static byte mymac[] = { 0x00,0x01,0x02,0x03,0x04,0x6E };
static byte myip[] = { 172,16,156,25};
static byte gwip[] = {172,16,156,254 };

byte Ethernet::buffer[1000];

BufferFiller bfill;


int reading[4]; 
int t=0; //that’s a variable to store temperature values
int h=0; //that’s a variable to store humidity values
int l;//that’s a variable to store LDR values
int nl=0;
int Timer= 0;

void setup () 
{
  
  Serial.begin(9600);
  radio.begin();
  
 radio.openReadingPipe(1,pipes[1]);
radio.openReadingPipe(2,pipes[3]);

radio.startListening();
  
  if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)
  Serial.println( "Failed to access Ethernet controller");
  ether.staticSetup(myip, gwip);  
  
}

static void ReadError()
{
     l=0;
     t= 0;
     h= 0;
     nl=0;
}

void loop () {
  delay(100);
  if ( radio.available() )
  {
    bool done = false;
    while (!done)
    {
      
      done = radio.read( reading, sizeof(reading) );
    
    if(reading[0]==2)
    {
       Serial.print("GROUP = ");
      Serial.println(reading[0]);
      Serial.print("LDR = ");      
      Serial.println(reading[1]);
      Serial.print("Temp = ");      
      Serial.println(reading[2]);   
      Serial.print("Humi  = ");
      Serial.println(reading[3]);
      l=reading[1];
      t= reading[2];
      h= reading[3];
      if(reading[1]>500)
      {
       //???????????? how to make l to read as "ON"
      }
      else if (reading[1]<500)
      {
        //?????????????? how to make l to read as "OFF"
      }
      
      
    }
    else if(reading[0]==1)
    {
      
      Serial.print("GROUP = ");
      Serial.println(reading[0]);
      Serial.print("NANO LDR = ");      
      Serial.println(reading[1]);
      nl=reading[1];
    }
   
    }
  }
  else
  {    
  
  //Serial.println("No radio available");
  Timer +=1;
   }  
  
   Timer  = Timer+1;
  if(Timer==30)
  {
    ReadError(); 
    Timer=0;
  }
 
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
  if (pos)  // check if valid tcp data is received
 {
 
    ether.httpServerReply(homePage()); // send web page data
    
 }
 
}

//  Here we build a web page and pass the t and h values into it
static word homePage() {
      
      
   bfill = ether.tcpOffset();
    bfill.emit_p(PSTR(
   "HTTP/1.0 503 OK\r\r\r\r\n"                      
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n\n"                      
    "\r\n"                                         
    "<meta http-equiv='refresh' content='10'/>"    // refresh rate 5sec
    "<title><h2>Arduino TESTING</h2></title>"        //To change the Tab name
    "<body style='background-color:rgb(255,200,180);'>" // to change colour of the page
    "<h1 style='text-align: center;'><em><span style='color: rgb(153, 0, 0);'>This is a testing page for Arduino</span></em></h1>"
    "<h1> Arduino TESTING</h1>"                     // Add header 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  "<hr />"
  "<hr />"
  "<h1 style='text-align: center;'><b>Room monitoring system<b></h3>"
  "<hr />"
  "<h2>S449 Wireless Development Lab: 
</h2>"
  "<h3>Temperature &nbsp; : $D C 
Humidity &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; :  $D %
light intensity&nbsp;  :  $D 
</h3><hr>"

  "<h2>S439 Wireless Test & Measurment Lab: 
</h2>"
  "<h3>light intensity&nbsp;  :  $D 
</h3><hr>"
  ),t, h, l, nl  ); // wanna to show l as text form.

  return bfill.position();
}

mathew1989:
Hi all, i manage to solve the communication problem.

Please explain how you did that for the benefit of other readers

Right now, i wish to make my reading of declared integer l to be "OFF" /"ON" text, so that show the status in the web, instead of showing numbers. Please advice

I'm not sure I understand and I can't immediately see where, in your code, this happens. But something along these lines is probably what you need

if (declaredInteger == 1) {
   Serial.println("ON");
}
else {
   Serial.println("OFF");
}

...R

i just mainly group the sets of data by

 if(reading[0]==2)
    {
       Serial.print("GROUP = ");
      Serial.println(reading[0]);
      Serial.print("LDR = ");      
      Serial.println(reading[1]);
      Serial.print("Temp = ");      
      Serial.println(reading[2]);   
      Serial.print("Humi  = ");
      Serial.println(reading[3]);
      l=reading[1];
      t= reading[2];
      h= reading[3];
      if(reading[1]>500)
      {
       //???????????? how to make l to read as "ON"
      }
      else if (reading[1]<500)
      {
        //?????????????? how to make l to read as "OFF"
      }
      
      
    }
    else if(reading[0]==1)
    {
      
      Serial.print("GROUP = ");
      Serial.println(reading[0]);
      Serial.print("NANO LDR = ");      
      Serial.println(reading[1]);
      nl=reading[1];
    }

and setting TX1 reading[0] as 1 and TX2 reading[0] as 2.

As for now, i wanted to send “ON” or “OFF” to the web.

my RX code

#include <SPI.h>
#include <EtherCard.h>
#include <nRF24L01.h>
#include <RF24.h>

#define CE_PIN   9
#define CSN_PIN 8

const uint64_t pipes[6] = {0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL, 0xF0F0F0F0C3LL,0xF0F0F0F0C4LL,0xF0F0F0F0C5LL,0xF0F0F0F0C6LL };


RF24 radio(CE_PIN, CSN_PIN); 

static byte mymac[] = { 0x00,0x01,0x02,0x03,0x04,0x6E };
static byte myip[] = { 172,16,156,25};
static byte gwip[] = {172,16,156,254 };

byte Ethernet::buffer[1200];

BufferFiller bfill;


int reading[4]; 
int t2=0; //that’s a variable to store temperature values
int h2=0; //that’s a variable to store humidity values
int l2=0;//that’s a variable to store LDR values

int l3=0;
int t3=0;

int l1=0;
int t1=0;
int Timer= 0;

int threshold=700;

void setup () 
{
  
  Serial.begin(9600);
  radio.begin();
  
 radio.openReadingPipe(1,pipes[1]);
radio.openReadingPipe(2,pipes[3]);
radio.openReadingPipe(3,pipes[2]);


radio.startListening();
  
  if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)
  Serial.println( "Failed to access Ethernet controller");
  ether.staticSetup(myip, gwip);  
  
}

static void ReadError()
{
   l1=0;
     t1=0;

     l2=0;
     t2= 0;
     h2= 0;
    
}

void loop () {

  if ( radio.available() )
  {
    bool done = false;
    while (!done)
    {
      
      done = radio.read( reading, sizeof(reading) );
    
    if(reading[0]==2)
    {
      Serial.print("GROUP = ");
      Serial.println(reading[0]);
      Serial.print("LDR = ");      
      Serial.print(reading[1]);
      Serial.print(" ");
      Serial.print("Temp = ");      
      Serial.print(reading[2]);
      Serial.print(" ");   
      Serial.print("Humi  = ");
      Serial.println(reading[3]);
      Serial.println(" ");
      l2=reading[1];
      t2= reading[2];
      h2= reading[3];
           
      
    }
    else if(reading[0]==1)
    {
      
      Serial.print("GROUP = ");
      Serial.println(reading[0]);
      Serial.print("Temp = ");      
      Serial.print(reading[1]);
      Serial.print(" ");
      Serial.print("LDR = ");      
      Serial.println(reading[2]); 
      Serial.println("");
      l1=reading[2];
      t1=reading[1];
    }
      else if(reading[0]==3)
    {
      
     Serial.print("GROUP = ");
      Serial.println(reading[0]);
      Serial.print("Temp = ");      
      Serial.print(reading[1]);
      Serial.print(" ");
      Serial.print("LDR = ");      
      Serial.println(reading[2]); 
      Serial.println(""); 
      l3=reading[2];
      t3=reading[1];
    }
   
    }
  }
  else
  {    
  
  //Serial.println("No radio available");
  Timer +=1;
   }  
  
   Timer  = Timer+1;
  if(Timer==30)
  {
    ReadError(); 
    Timer=0;
  }
 
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
 // if (pos)  // check if valid tcp data is received
 //{
 
    ether.httpServerReply(homePage()); // send web page data
    
 //}
 
}

//  Here we build a web page and pass the t and h values into it
static word homePage() {
      
      
   bfill = ether.tcpOffset();
   
      if ((l2<threshold)&&(l1<threshold)&&(l3<threshold))//000
    {      
    bfill.emit_p(PSTR(  
   "HTTP/1.0 503 OK\r\r\r\r\n"                      
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n\n"                      
    "\r\n"                                         
    "<meta http-equiv='refresh' content='5'/>"    // refresh rate 5sec
     "<title><h2>NYP Project</h2></title>"        //To change the Tab name
    "<body style='background-color:rgb(255,200,180);'>" // to change colour of the page
    "<h1 style='text-align: center;'><em><span style='color: rgb(153, 0, 0);'>This is a testing page for Arduino system</span></em></h1>"
     "<h1> NYP PROJECT</h1>"                     // Add header 
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    "<hr />"
    "<hr />"
    "<h1 style='text-align: center;'><b>Room monitoring system<b></h3>"
    "<hr />"
    "<h2>S449 Wireless Development Lab: 
</h2>"  //Group2 data
    "<h3>Temperature &nbsp; : $D C 
Humidity &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; :  $D %
Light intensity  :  $D

"
    "Room Light &nbsp&nbsp&nbsp&nbsp;: OFF  
</h3><hr>"

    "<h2>S439 Wireless Test & Measurment Lab: 
</h2>" //Group 1 data
    "<h3>Temperature &nbsp; : $D C 
Light intensity  :  $D 

Room Light &nbsp&nbsp&nbsp&nbsp;: OFF  
</h3><hr>"
    
    "<h2>S437 Embedded System Development Lab: 
</h2>" //Group 3 data
    "<h3>Temperature &nbsp; : $D C 
Light intensity  :  $D 

Room Light &nbsp&nbsp&nbsp&nbsp;: OFF  
</h3><hr></h3><hr>"
    ),t2, h2,l2,t1, l1, t3,l3  ); // wanna to show l as text form.
     }   
 
     else if ((l2<threshold)&&(l1<threshold)&&(l3>threshold))//001
     {
        bfill.emit_p(PSTR(  
   "HTTP/1.0 503 OK\r\r\r\r\n"                      
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n\n"                      
    "\r\n"                                         
    "<meta http-equiv='refresh' content='5'/>"    // refresh rate 5sec
     "<title><h2>NYP Project</h2></title>"        //To change the Tab name
    "<body style='background-color:rgb(255,200,180);'>" // to change colour of the page
    "<h1 style='text-align: center;'><em><span style='color: rgb(153, 0, 0);'>This is a testing page for Arduino system</span></em></h1>"
    "<h1> NYP PROJECT</h1>"                     // Add header 
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    "<hr />"
    "<hr />"
    "<h1 style='text-align: center;'><b>Room monitoring system<b></h3>"
    "<hr />"
    "<h2>S449 Wireless Development Lab: 
</h2>" //Group2 data
    "<h3>Temperature &nbsp; : $D C 
Humidity &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; :  $D %
Light intensity  :  $D

"
    "Room Light &nbsp&nbsp&nbsp&nbsp;: OFF  
</h3><hr>"

   "<h2>S439 Wireless Test & Measurment Lab: 
</h2>" //Group 1 data
    "<h3>Temperature &nbsp; : $D C 
Light intensity  :  $D 

Room Light &nbsp&nbsp&nbsp&nbsp;: OFF  
</h3><hr>"
    
    "<h2>S437 Embedded System Development Lab: 
</h2>" //Group 3 data
    "<h3>Temperature &nbsp; : $D C 
Light intensity  :  $D 

Room Light &nbsp&nbsp&nbsp&nbsp;: ON  
</h3><hr></h3><hr>"
     ),t2, h2,l2,t1, l1,t3,l3  ); // wanna to show l as text form.
       
     }
     
       else if ((l2<threshold)&&(l1>threshold)&&(l3<threshold))//010
     {
        bfill.emit_p(PSTR(  
   "HTTP/1.0 503 OK\r\r\r\r\n"                      
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n\n"                      
    "\r\n"                                         
    "<meta http-equiv='refresh' content='5'/>"    // refresh rate 5sec
     "<title><h2>NYP Project</h2></title>"        //To change the Tab name
    "<body style='background-color:rgb(255,200,180);'>" // to change colour of the page
    "<h1 style='text-align: center;'><em><span style='color: rgb(153, 0, 0);'>This is a testing page for Arduino system</span></em></h1>"
    "<h1> NYP PROJECT</h1>"                     // Add header 
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    "<hr />"
    "<hr />"
    "<h1 style='text-align: center;'><b>Room monitoring system<b></h3>"
    "<hr />"
    "<h2>S449 Wireless Development Lab: 
</h2>"//Group2 data
    "<h3>Temperature &nbsp; : $D C 
Humidity &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; :  $D %
Light intensity  :  $D

"
    "Room Light &nbsp&nbsp&nbsp&nbsp;: OFF  
</h3><hr>"

   "<h2>S439 Wireless Test & Measurment Lab: 
</h2>" //Group 1 data
    "<h3>Temperature &nbsp; : $D C 
Light intensity  :  $D 

Room Light &nbsp&nbsp&nbsp&nbsp;: ON  
</h3><hr>"
    
    "<h2>S437 Embedded System Development Lab: 
</h2>" //Group 3 data
    "<h3>Temperature &nbsp; : $D C 
Light intensity  :  $D 

Room Light &nbsp&nbsp&nbsp&nbsp;: OFF  
</h3><hr></h3><hr>"
     ),t2, h2,l2,t1, l1,t3,l3 ); // wanna to show l as text form.
       
     }
      
     
     
  return bfill.position();
}

i keep repeating the else if{} portion to make the room light text to display “ON” and “OFF”.
is there a better way to code it? i will see a bigger problem if there is more then 4 set of data.

 else if ((l2>threshold)&&(l1<threshold)&&(l3<threshold))//100
     {
        bfill.emit_p(PSTR(  
   "HTTP/1.0 503 OK\r\r\r\r\n"                      
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n\n"                      
    "\r\n"                                         
    "<meta http-equiv='refresh' content='5'/>"    // refresh rate 5sec
    "<title><h2>NYP Project</h2></title>"        //To change the Tab name
    "<body style='background-color:rgb(255,200,180);'>" // to change colour of the page
    "<h1 style='text-align: center;'><em><span style='color: rgb(153, 0, 0);'>This is a testing page for Arduino system</span></em></h1>"
    "<h1>NYP PROJECT</h1>"                     // Add header 
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    "<hr />"
    "<hr />"
    "<h1 style='text-align: center;'><b>Room monitoring system<b></h3>"
    "<hr />"
    "<h2>S449 Wireless Development Lab: 
</h2>"//Group2 data
    "<h3>Temperature &nbsp; : $D C 
Humidity &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp; :  $D %
Light intensity  :  $D

"
    "Room Light &nbsp&nbsp&nbsp&nbsp;: ON  
</h3><hr>"
    
    "<h2>S439 Wireless Test & Measurment Lab: 
</h2>" //Group 1 data
    "<h3>Temperature &nbsp; : $D C 
Light intensity  :  $D 

Room Light &nbsp&nbsp&nbsp&nbsp;: OFF  
</h3><hr>"
    
    "<h2>S437 Embedded System Development Lab: 
</h2>" //Group 3 data
    "<h3>Temperature &nbsp; : $D C 
Light intensity  :  $D 

Room Light &nbsp&nbsp&nbsp&nbsp;: OFF  
</h3><hr></h3><hr>"
     ),t2, h2,l2,t1, l1,t3,l3  ); // wanna to show l as text form.
     }

I am confused by all your Replies #15, #16 and #17.

Is any of them intended to be a response to my suggestion, in Reply #14, to explain how you "manage to solve the communication problem" ?

If you have a question please post the entire program as a single unit and tell us where in the program you think the problem is.

...R

Robin2:
I am confused by all your Replies #15, #16 and #17.

Is any of them intended to be a response to my suggestion, in Reply #14, to explain how you "manage to solve the communication problem" ?

If you have a question please post the entire program as a single unit and tell us where in the program you think the problem is.

...R

Forgive me for not being clear on on reply on solution.
For TX1 reading[0], i give a fix integer "1", TX2 reading[0] with a fix integer "2". The purpose is to group the set of data.
When RX receive the sets of data from both TX1 and TX2, RX serial monitor will display the data set by set by using the else if example in Reply #15.

Do let me know if i am not clear on my explanation.