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
examples/xbee09.cpp@14:50ee389d681f, 2013-03-21 (annotated)
- Committer:
- yamaguch
- Date:
- Thu Mar 21 07:16:44 2013 +0000
- Revision:
- 14:50ee389d681f
- Parent:
- 11:25a790b8feb0
updated to use new XBee lib
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yamaguch | 11:25a790b8feb0 | 1 | #include "XBee.h" |
yamaguch | 11:25a790b8feb0 | 2 | |
yamaguch | 11:25a790b8feb0 | 3 | void xbee09() { |
yamaguch | 14:50ee389d681f | 4 | XBee xbee(p9, p10, 2); |
yamaguch | 11:25a790b8feb0 | 5 | xbee.baud(115200); |
yamaguch | 11:25a790b8feb0 | 6 | xbee.init(); |
yamaguch | 11:25a790b8feb0 | 7 | |
yamaguch | 11:25a790b8feb0 | 8 | XBeeAddress64 destination(0x0013A20040606567); |
yamaguch | 11:25a790b8feb0 | 9 | printf("Destination: %s\n", (char *) destination); |
yamaguch | 11:25a790b8feb0 | 10 | xbee.setDestination(destination); |
yamaguch | 11:25a790b8feb0 | 11 | |
yamaguch | 11:25a790b8feb0 | 12 | xbee.printf("Comment allez-vous?\n"); |
yamaguch | 11:25a790b8feb0 | 13 | printf("sent: Comment allez-vous?\n"); |
yamaguch | 11:25a790b8feb0 | 14 | |
yamaguch | 11:25a790b8feb0 | 15 | while (true) { |
yamaguch | 11:25a790b8feb0 | 16 | if (xbee.receive() == XBee::ZigBeeReceivePacket) { |
yamaguch | 11:25a790b8feb0 | 17 | XBeeReceivedData data; |
yamaguch | 11:25a790b8feb0 | 18 | xbee.scan(data); |
yamaguch | 11:25a790b8feb0 | 19 | |
yamaguch | 11:25a790b8feb0 | 20 | printf("received: %s\n", (char *) data); |
yamaguch | 11:25a790b8feb0 | 21 | break; |
yamaguch | 11:25a790b8feb0 | 22 | } |
yamaguch | 11:25a790b8feb0 | 23 | } |
yamaguch | 11:25a790b8feb0 | 24 | } |