xbee is not responding to the mbed board command..help

hey… i hv been working on XBEEs and and LPC1768 mbed boar for like 1 month… i m not able to do a simple communication between two xbees interfaced with Mbed board… its like even if i remove the xbees it responds in the same way… i have checked my XBEEs its working perfectly… can any one suggest me wat- may be the problem?? i kinda need urgent help

the connection which i m doing is( ps i m use xbee usb explorer board for XBEE) xbee rx to mbed tx xbee tx to mbed rx xbee ground to mbed ground xbee vcc to mbed last pin(VOUT)

i m using very simple codes to transmit n receive

#include "mbed.h"
Serial pc(USBTX, USBRX);
Serial xbee1(p9,p10);
 DigitalOut rst1(p8); //Digital reset for the XBee, 200ns for reset
 DigitalOut myled(LED3);//Create variable for Led 3 on the mbed
 
int main() { 
 
    rst1 = 0; //Set reset pin to 0
    myled = 0;//Set LED3 to 0
    wait_ms(1);//Wait at least one millisecond
    rst1 = 1;//Set reset pin to 1
    wait_ms(1);//Wait another millisecond
    
     
    while (1) {//Neverending Loop
        
        myled = 1; //Turn Led 3 Off
        int a;
        a=10;
        xbee1.printf("%d", a); //XBee write whatever the PC is sending
          // xbee1.putc(Y);
            wait(1);
            myled = 0; //Turn Led 3 on for succcessfull communication
            wait(1);
        }
    }

receiver code

#include "mbed.h"
 Serial xbee1(p9, p10);
 Serial pc(USBTX, USBRX);
 
 DigitalOut rst1(p8);
 
 DigitalOut myled2(LED2);
 DigitalOut myled4(LED4);
 int main() {
 
     rst1 = 0;   //Set reset pin to 0
     myled2 = 0;
     myled4=0;
     wait_ms(1);
     rst1 = 1;   //Set reset pin to 1
     wait_ms(1);
     int X; 
 
     while (1) {
        if(xbee1.readable()){
             wait(1);
            // xbeel.scanf("%d", &X);
              myled2 = 1;
             
            xbee1.scanf("%d", &X);
           // X = xbee1.getc();
             wait(1);
             myled2 = 0;    
             if(X==10) {
            pc.printf("  data rcv %d",X);  
             myled4=1;  
             wait(1);
               
             }    
             else
             
             pc.printf(" incorrect data rcv  ");  
             
           }
         }
     }
 

plz do help its urgent

I’m not wholly familiar with the syntax of your micro, but it sounds like you’re just sending a single character and depending on which character is received… turning a light on or off.

First question: What type of XBee are you using?

If it is Series 2 (ZigBee) or XBee Wi-Fi then we need to ensure we have the radios configured properly. Pretty much every other XBee type should work as a 9600 baud serial bridge out-of-the-box.

Second Question: What baud rate is your micro using?

I don’t see any init string that specifies the baud rate. XBees work at 9600 baud by default, but can be set to any interface rate you need.

Third Question: Have you tested the XBees outside of your application?

Plug them both into a PC and try sending data using a terminal. If they’re configured properly, you should be able to easily send serial data back and forth. If you only have one USB interface board, you could bridge the DIN and DOUT pins on the remote XBee to create a loopback.

Fourth Question: Have you tested your application without the XBees?

There’s a few ways you can try this. Instead of having both mbed boards, have one XBee connected to a PC and using a terminal window, send your command characters and see if it works. Then reverse it and when your program sends the character, do you see it come out of the XBee connected to the PC? Is it the character you expected?

Another thing you can do is eliminate the XBees entirely. Because the radios are acting as a serial bridge, you could use two wires to bridge the UARTS of the mbed boards. With the XBees taken out of the system, does it work?

Hopefully this gives you a starting point. Good luck!

-Charles