takashi yamanoue
/
XBee_API_ex2
Xbee test 2
main.cpp@0:ffac63d6a7f0, 2012-07-21 (annotated)
- Committer:
- takashiyamanoue
- Date:
- Sat Jul 21 04:08:27 2012 +0000
- Revision:
- 0:ffac63d6a7f0
xbee test 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takashiyamanoue | 0:ffac63d6a7f0 | 1 | #include "mbed.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 2 | #include "XBee.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 3 | |
takashiyamanoue | 0:ffac63d6a7f0 | 4 | XBee xbee(p13, p14); |
takashiyamanoue | 0:ffac63d6a7f0 | 5 | Serial pc(USBTX, USBRX); |
takashiyamanoue | 0:ffac63d6a7f0 | 6 | |
takashiyamanoue | 0:ffac63d6a7f0 | 7 | int main() { |
takashiyamanoue | 0:ffac63d6a7f0 | 8 | |
takashiyamanoue | 0:ffac63d6a7f0 | 9 | uint8_t Cmd[] = {'D', '4'}; |
takashiyamanoue | 0:ffac63d6a7f0 | 10 | uint8_t Low[] = {0x04}; |
takashiyamanoue | 0:ffac63d6a7f0 | 11 | uint8_t High[] = {0x05}; |
takashiyamanoue | 0:ffac63d6a7f0 | 12 | XBeeAddress64 remoteAddress(0x0013A200, 0x403A8C82); |
takashiyamanoue | 0:ffac63d6a7f0 | 13 | RemoteAtCommandRequest remoteAtRequest; |
takashiyamanoue | 0:ffac63d6a7f0 | 14 | |
takashiyamanoue | 0:ffac63d6a7f0 | 15 | wait(1); |
takashiyamanoue | 0:ffac63d6a7f0 | 16 | xbee.begin(115200); |
takashiyamanoue | 0:ffac63d6a7f0 | 17 | |
takashiyamanoue | 0:ffac63d6a7f0 | 18 | while(1){ |
takashiyamanoue | 0:ffac63d6a7f0 | 19 | // remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd, Low, sizeof(Low)); |
takashiyamanoue | 0:ffac63d6a7f0 | 20 | remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd, Low, sizeof(Low)); |
takashiyamanoue | 0:ffac63d6a7f0 | 21 | // remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd); |
takashiyamanoue | 0:ffac63d6a7f0 | 22 | remoteAtRequest.setApplyChanges(true); |
takashiyamanoue | 0:ffac63d6a7f0 | 23 | xbee.send(remoteAtRequest); |
takashiyamanoue | 0:ffac63d6a7f0 | 24 | |
takashiyamanoue | 0:ffac63d6a7f0 | 25 | wait(1.0); |
takashiyamanoue | 0:ffac63d6a7f0 | 26 | remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd, High, sizeof(High)); |
takashiyamanoue | 0:ffac63d6a7f0 | 27 | // remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd); |
takashiyamanoue | 0:ffac63d6a7f0 | 28 | remoteAtRequest.setApplyChanges(true); |
takashiyamanoue | 0:ffac63d6a7f0 | 29 | xbee.send(remoteAtRequest); |
takashiyamanoue | 0:ffac63d6a7f0 | 30 | wait(1.0); |
takashiyamanoue | 0:ffac63d6a7f0 | 31 | |
takashiyamanoue | 0:ffac63d6a7f0 | 32 | } |
takashiyamanoue | 0:ffac63d6a7f0 | 33 | } |