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