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/xbee_io05.cpp@7:39deffbdcae4, 2012-09-26 (annotated)
- Committer:
- yamaguch
- Date:
- Wed Sep 26 06:13:30 2012 +0000
- Revision:
- 7:39deffbdcae4
- Parent:
- xbeeio5.cpp@6:d456c203adb6
renamed function names
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yamaguch | 0:34e0352d7396 | 1 | #include "XBee.h" |
yamaguch | 0:34e0352d7396 | 2 | |
yamaguch | 7:39deffbdcae4 | 3 | void xbee_io05() { |
yamaguch | 5:d01cf03058f6 | 4 | XBee xbee(p9, p10); |
yamaguch | 5:d01cf03058f6 | 5 | xbee.baud(115200); |
yamaguch | 0:34e0352d7396 | 6 | xbee.init(); |
yamaguch | 0:34e0352d7396 | 7 | |
yamaguch | 6:d456c203adb6 | 8 | xbee.setDestination(XBeeAddress64(0x0013A200, 0x40310E99)); |
yamaguch | 0:34e0352d7396 | 9 | |
yamaguch | 6:d456c203adb6 | 10 | xbee.sendRemoteCommand("D1", 2); // analog input |
yamaguch | 6:d456c203adb6 | 11 | while (xbee.receive()); // clear receive buffer |
yamaguch | 0:34e0352d7396 | 12 | |
yamaguch | 0:34e0352d7396 | 13 | for (int i = 0; i < 60; i++) { |
yamaguch | 0:34e0352d7396 | 14 | xbee.sendRemoteCommand("IS"); |
yamaguch | 0:34e0352d7396 | 15 | if (xbee.receive() == XBee::RemoteCommandResponse) { |
yamaguch | 5:d01cf03058f6 | 16 | XBeeCommandData data(16); |
yamaguch | 5:d01cf03058f6 | 17 | xbee.scan(data); |
yamaguch | 5:d01cf03058f6 | 18 | |
yamaguch | 0:34e0352d7396 | 19 | IOSample sample(data); |
yamaguch | 6:d456c203adb6 | 20 | printf("AD1 = %3.2fV\n", 1.2 * sample.ad[1] / 1023); |
yamaguch | 0:34e0352d7396 | 21 | } |
yamaguch | 0:34e0352d7396 | 22 | wait(1); |
yamaguch | 0:34e0352d7396 | 23 | } |
yamaguch | 0:34e0352d7396 | 24 | |
yamaguch | 0:34e0352d7396 | 25 | printf("done.\n"); |
yamaguch | 0:34e0352d7396 | 26 | } |