Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed XBee mbed-rtos
Diff: xbee10.cpp
- Revision:
- 5:d01cf03058f6
- Parent:
- 1:dedbc2504219
- Child:
- 6:d456c203adb6
--- a/xbee10.cpp Mon Nov 28 01:59:03 2011 +0000 +++ b/xbee10.cpp Thu Apr 12 10:21:11 2012 +0000 @@ -1,21 +1,23 @@ #include "XBee.h" void xbee10() { - Serial ser(p9, p10); - ser.baud(115200); - XBee xbee(ser); + XBee xbee(p9, p10); + xbee.baud(115200); xbee.init(); - printf("Network Reset\n"); + while (xbee.receive(5) != XBee::ZigBeeReceivePacket) + printf("waiting...\n"); + + XBeeAddress64 address64; + XBeeReceivedData data; + xbee.scan(address64); + xbee.scan(data); - char param[] = {0x00}; - xbee.sendCommand("NR", param, 1); - xbee.sendCommand("OP"); - xbee.sendCommand("OI"); - xbee.sendCommand("CH"); + printf("received from %s: %s\n", (char *) address64, (char *) data); - while (xbee.receive()) - xbee.dump(); - - printf("done.\n"); + if (strcmp(data, "Comment allez-vous?\n") == 0) { + xbee.setDestination(address64); + xbee.printf("Je vais bien, merci.\n"); + printf("sent: Je vais bien, merci.\n"); + } } \ No newline at end of file