10 years, 2 months ago.

Readding data from XBee and sending end data to XBee

Hi Im having problems with reading data from x bee in the serial console and also sending data from the x bee to the serial console, Can some body help me?

here is the code that I am using:

  1. include "mbed.h"
  2. include "xbee.h"

xbee xbee2(p9,p10,p11); Serial pc(USBTX, USBRX); Abre comunicacion entre la placa y la computadora

DigitalOut myled1(LED1); DigitalOut myled2(LED2); DigitalOut myled3(LED3); DigitalOut myled4(LED4);

int main () { Programa principal

myled1=1; myled2=1; myled3=0; myled4=0;

char send_data[202]; Xbee buffer size is 202 bytes char read_data[202]; Xbee buffer size is 202 bytes

pc.printf("iniciando\n"); Imprime en la trminal myled4=1;

while(1) { pc.scanf("%s",send_data); Read data from serial console xbee2.SendData(send_data); Send data to XBee xbee2.RecieveData(read_data,0); Read data from the XBee pc.printf("You said:%s",read_data); } }

Be the first to answer this question.