I am not sure if this is a right place to put this question but if anyone is familiar with xbee and can help me with this problem, i highly appreciate your help.


I have two xbees one configured as coordinator api and another configured as router api.


I have attached those two xbees with two arduinos and just to test communication between them i have a simple code


Code in arduino hooked to coordinator xbee


Description: This will simply check button press. Upon press it will send zigbee transmit request frame.


Code:
int BUTTON1 = 3;




void setup(){


pinMode(BUTTON1, INPUT);


Serial.begin(9600);
  
}


void loop(){ 
  
  
if (digitalRead(BUTTON1) == HIGH){
 
 sendData();
 
  
}


 
}






void sendData(){
  
  
  Serial.write(0x7E);
  
  Serial.write(0x00);
  Serial.write(0x16);
  
  Serial.write(0x10);
  
  Serial.write(0x01);
  
  
  Serial.write(0x00);
  Serial.write(0x13);
  Serial.write(0xA2);
  Serial.write(0x00);
  Serial.write(0x40);
  Serial.write(0x8C);
  Serial.write(0xC6);
  Serial.write(0xD4);
  
  
  Serial.write(0x20);
  Serial.write(0x01);
  
  
  Serial.write(0x00);
  
  
  Serial.write(0x00);
  


//data start  
  Serial.write(0x54);
  Serial.write(0x78);
  Serial.write(0x44);
  Serial.write(0x61);
  Serial.write(0x74);
  Serial.write(0x61);
  Serial.write(0x30);
  Serial.write(0x41);
  
  Serial.write(0x13);
  
  
    
  
  delay(10);
  
  
  
  
}

Next is the code for arduino hooked to router xbee.


Description: This simply scans "0x54" byte and if it is there then lights up a led. As you can see coordinator sends this byte 0x54 along with other bytes.


Code:
int BELL = 5;


void setup(){


  pinMode(BELL, OUTPUT);


  Serial.begin(9600);




}




void loop(){






  if(Serial.available() >= 25){




    if(Serial.read() == 0x7E){




      for(int i=0;i<24;i++){


        if(Serial.read() == 0x54)
        {


          digitalWrite(BELL, HIGH); 


        }


      }








    }




  }




}

I would like to add that when i turn on serial monitor when i press button the serial monitor displays correctly what data was passed also tx lights up. So my assumption is that the problem is in the router not getting the data rather than coordinator not sending the data. I have been trying to hunt this problem for couple of hours now with no success. Any help is highly appreciated!