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.
main.cpp@3:f5c84899f4d1, 2013-12-18 (annotated)
- Committer:
- okini3939
- Date:
- Wed Dec 18 02:32:57 2013 +0000
- Revision:
- 3:f5c84899f4d1
- Parent:
- 2:505c58df1f94
fix XBee_conf.h
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| okini3939 | 0:12a6db2d1600 | 1 | #include "mbed.h" |
| okini3939 | 0:12a6db2d1600 | 2 | #include "XBee.h" |
| okini3939 | 0:12a6db2d1600 | 3 | |
| okini3939 | 0:12a6db2d1600 | 4 | DigitalOut myled(LED1); |
| okini3939 | 0:12a6db2d1600 | 5 | XBee xbee(p13, p14); |
| okini3939 | 0:12a6db2d1600 | 6 | XBeeAddress64 remoteAddress = XBeeAddress64(0x0013A200, 0x40319F25); |
| okini3939 | 0:12a6db2d1600 | 7 | |
| okini3939 | 0:12a6db2d1600 | 8 | int main() { |
| okini3939 | 2:505c58df1f94 | 9 | uint8_t Cmd[] = {'D', '4'}; |
| okini3939 | 2:505c58df1f94 | 10 | uint8_t Low[] = {0x04}; |
| okini3939 | 2:505c58df1f94 | 11 | uint8_t High[] = {0x05}; |
| okini3939 | 0:12a6db2d1600 | 12 | RemoteAtCommandRequest remoteAtRequest; |
| okini3939 | 0:12a6db2d1600 | 13 | |
| okini3939 | 0:12a6db2d1600 | 14 | wait(1); |
| okini3939 | 0:12a6db2d1600 | 15 | xbee.begin(9800); |
| okini3939 | 0:12a6db2d1600 | 16 | |
| okini3939 | 2:505c58df1f94 | 17 | remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd, Low, sizeof(Low)); |
| okini3939 | 1:f9ececd7aa01 | 18 | remoteAtRequest.setApplyChanges(true); |
| okini3939 | 0:12a6db2d1600 | 19 | |
| okini3939 | 0:12a6db2d1600 | 20 | while(1) { |
| okini3939 | 0:12a6db2d1600 | 21 | myled = 1; |
| okini3939 | 2:505c58df1f94 | 22 | remoteAtRequest.setCommandValue(Low); |
| okini3939 | 2:505c58df1f94 | 23 | remoteAtRequest.setCommandValueLength(sizeof(Low)); |
| okini3939 | 0:12a6db2d1600 | 24 | xbee.send(remoteAtRequest); |
| okini3939 | 0:12a6db2d1600 | 25 | myled = 0; |
| okini3939 | 0:12a6db2d1600 | 26 | wait(1); |
| okini3939 | 0:12a6db2d1600 | 27 | |
| okini3939 | 0:12a6db2d1600 | 28 | myled = 1; |
| okini3939 | 2:505c58df1f94 | 29 | remoteAtRequest.setCommandValue(High); |
| okini3939 | 2:505c58df1f94 | 30 | remoteAtRequest.setCommandValueLength(sizeof(High)); |
| okini3939 | 0:12a6db2d1600 | 31 | xbee.send(remoteAtRequest); |
| okini3939 | 0:12a6db2d1600 | 32 | myled = 0; |
| okini3939 | 0:12a6db2d1600 | 33 | wait(1); |
| okini3939 | 0:12a6db2d1600 | 34 | } |
| okini3939 | 0:12a6db2d1600 | 35 | } |