Hiroshi Yamaguchi / Mbed 2 deprecated XBeeExamples

Dependencies:   mbed XBee mbed-rtos

examples/xbee09.cpp

Committer:
yamaguch
Date:
2013-01-29
Revision:
11:25a790b8feb0
Child:
14:50ee389d681f

File content as of revision 11:25a790b8feb0:

#include "XBee.h"

void xbee09() {
    XBee xbee(p9, p10, 2, true);
    xbee.baud(115200);
    xbee.init();

    XBeeAddress64 destination(0x0013A20040606567);
    printf("Destination: %s\n", (char *) destination);
    xbee.setDestination(destination);

    xbee.printf("Comment allez-vous?\n");
    printf("sent: Comment allez-vous?\n");

    while (true) {
        if (xbee.receive() == XBee::ZigBeeReceivePacket) {
            XBeeReceivedData data;
            xbee.scan(data);

            printf("received: %s\n", (char *) data);
            break;
        }
    }
}