takashi yamanoue
/
XBee_API_ex1
xbee test program 1
main.cpp@0:fb7cf60c8229, 2012-07-21 (annotated)
- Committer:
- takashiyamanoue
- Date:
- Sat Jul 21 04:06:22 2012 +0000
- Revision:
- 0:fb7cf60c8229
XBee test 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takashiyamanoue | 0:fb7cf60c8229 | 1 | #include "mbed.h" |
takashiyamanoue | 0:fb7cf60c8229 | 2 | #include "XBee.h" |
takashiyamanoue | 0:fb7cf60c8229 | 3 | |
takashiyamanoue | 0:fb7cf60c8229 | 4 | XBee xbee(p13, p14); |
takashiyamanoue | 0:fb7cf60c8229 | 5 | |
takashiyamanoue | 0:fb7cf60c8229 | 6 | int main() { |
takashiyamanoue | 0:fb7cf60c8229 | 7 | uint8_t Cmd[] = {'D', '4'}; |
takashiyamanoue | 0:fb7cf60c8229 | 8 | uint8_t Low[] = {0x05}; |
takashiyamanoue | 0:fb7cf60c8229 | 9 | uint8_t Val[] = {0x04}; |
takashiyamanoue | 0:fb7cf60c8229 | 10 | XBeeAddress64 remoteAddress(0x0013A200, 0x403A8C82); |
takashiyamanoue | 0:fb7cf60c8229 | 11 | RemoteAtCommandRequest remoteAtRequest; |
takashiyamanoue | 0:fb7cf60c8229 | 12 | |
takashiyamanoue | 0:fb7cf60c8229 | 13 | wait(1); |
takashiyamanoue | 0:fb7cf60c8229 | 14 | xbee.begin(115200); |
takashiyamanoue | 0:fb7cf60c8229 | 15 | |
takashiyamanoue | 0:fb7cf60c8229 | 16 | remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd, Low, sizeof(Low)); |
takashiyamanoue | 0:fb7cf60c8229 | 17 | remoteAtRequest.setApplyChanges(true); |
takashiyamanoue | 0:fb7cf60c8229 | 18 | |
takashiyamanoue | 0:fb7cf60c8229 | 19 | remoteAtRequest.setCommandValue(Val); |
takashiyamanoue | 0:fb7cf60c8229 | 20 | remoteAtRequest.setCommandValueLength(sizeof(Val)); |
takashiyamanoue | 0:fb7cf60c8229 | 21 | xbee.send(remoteAtRequest); |
takashiyamanoue | 0:fb7cf60c8229 | 22 | } |