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: Command CommandPool GenCMD LSM9DS0 Mode Motor PinDetect Xbee mbed
Fork of VR_Robot by
main.cpp@5:c1b3251ba5d5, 2015-11-28 (annotated)
- Committer:
- Xiaofei
- Date:
- Sat Nov 28 01:02:09 2015 +0000
- Revision:
- 5:c1b3251ba5d5
- Parent:
- 2:d77f669c7feb
- Child:
- 6:7a38f754e030
c
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Xiaofei | 2:d77f669c7feb | 1 | #pragma once |
| Xiaofei | 0:526a865b9b03 | 2 | #include "mbed.h" |
| Xiaofei | 0:526a865b9b03 | 3 | #include "CommandPool.h" |
| Xiaofei | 2:d77f669c7feb | 4 | #include "Xbee.h" |
| Xiaofei | 5:c1b3251ba5d5 | 5 | #include "GenCMD.h" |
| Xiaofei | 0:526a865b9b03 | 6 | |
| Xiaofei | 0:526a865b9b03 | 7 | Command* cmd; |
| Xiaofei | 0:526a865b9b03 | 8 | CommandPool pool; |
| Xiaofei | 5:c1b3251ba5d5 | 9 | GenCMD gen_cmd; |
| Xiaofei | 5:c1b3251ba5d5 | 10 | Xbee xbee(p9,p10,p11); |
| Xiaofei | 5:c1b3251ba5d5 | 11 | |
| Xiaofei | 5:c1b3251ba5d5 | 12 | char cmd_buffer[3]; //LED; |
| Xiaofei | 2:d77f669c7feb | 13 | |
| Xiaofei | 0:526a865b9b03 | 14 | |
| Xiaofei | 0:526a865b9b03 | 15 | int main() |
| Xiaofei | 0:526a865b9b03 | 16 | { |
| Xiaofei | 0:526a865b9b03 | 17 | /* draft of main code*/ |
| Xiaofei | 0:526a865b9b03 | 18 | pool.init(); |
| Xiaofei | 5:c1b3251ba5d5 | 19 | gen_cmd.init(); |
| Xiaofei | 2:d77f669c7feb | 20 | |
| Xiaofei | 0:526a865b9b03 | 21 | while(1) |
| Xiaofei | 0:526a865b9b03 | 22 | { |
| Xiaofei | 5:c1b3251ba5d5 | 23 | gen_cmd.GenerateCMD(cmd_buffer); |
| Xiaofei | 0:526a865b9b03 | 24 | //if(med1.readable()) |
| Xiaofei | 0:526a865b9b03 | 25 | //{ |
| Xiaofei | 0:526a865b9b03 | 26 | //med1.read(cmd_buffer,20,callBack); // read to cmd buffer, and update command |
| Xiaofei | 5:c1b3251ba5d5 | 27 | //cmd = pool.getCommand(cmd_buffer); // if cmd is valid |
| Xiaofei | 0:526a865b9b03 | 28 | if(cmd) |
| Xiaofei | 0:526a865b9b03 | 29 | { |
| Xiaofei | 0:526a865b9b03 | 30 | cmd->execute(); // execute cmd |
| Xiaofei | 0:526a865b9b03 | 31 | } |
| Xiaofei | 0:526a865b9b03 | 32 | wait(0.5); |
| Xiaofei | 0:526a865b9b03 | 33 | //} |
| Xiaofei | 0:526a865b9b03 | 34 | } |
| Xiaofei | 0:526a865b9b03 | 35 | return 0; |
| Xiaofei | 0:526a865b9b03 | 36 | } |
