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@2:d77f669c7feb, 2015-11-22 (annotated)
- Committer:
- Xiaofei
- Date:
- Sun Nov 22 01:05:12 2015 +0000
- Revision:
- 2:d77f669c7feb
- Parent:
- 0:526a865b9b03
- Child:
- 5:c1b3251ba5d5
Commit
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 | 0:526a865b9b03 | 5 | |
| Xiaofei | 0:526a865b9b03 | 6 | Command* cmd; |
| Xiaofei | 0:526a865b9b03 | 7 | CommandPool pool; |
| Xiaofei | 2:d77f669c7feb | 8 | char CMD = MOVE_FORWARD; |
| Xiaofei | 2:d77f669c7feb | 9 | |
| Xiaofei | 0:526a865b9b03 | 10 | |
| Xiaofei | 0:526a865b9b03 | 11 | int main() |
| Xiaofei | 0:526a865b9b03 | 12 | { |
| Xiaofei | 0:526a865b9b03 | 13 | /* draft of main code*/ |
| Xiaofei | 0:526a865b9b03 | 14 | pool.init(); |
| Xiaofei | 2:d77f669c7feb | 15 | |
| Xiaofei | 0:526a865b9b03 | 16 | while(1) |
| Xiaofei | 0:526a865b9b03 | 17 | { |
| Xiaofei | 0:526a865b9b03 | 18 | //if(med1.readable()) |
| Xiaofei | 0:526a865b9b03 | 19 | //{ |
| Xiaofei | 0:526a865b9b03 | 20 | //med1.read(cmd_buffer,20,callBack); // read to cmd buffer, and update command |
| Xiaofei | 0:526a865b9b03 | 21 | cmd = pool.getCommand(CMD); // if cmd is valid |
| Xiaofei | 0:526a865b9b03 | 22 | if(cmd) |
| Xiaofei | 0:526a865b9b03 | 23 | { |
| Xiaofei | 0:526a865b9b03 | 24 | cmd->execute(); // execute cmd |
| Xiaofei | 0:526a865b9b03 | 25 | } |
| Xiaofei | 0:526a865b9b03 | 26 | wait(0.5); |
| Xiaofei | 0:526a865b9b03 | 27 | //} |
| Xiaofei | 0:526a865b9b03 | 28 | } |
| Xiaofei | 0:526a865b9b03 | 29 | return 0; |
| Xiaofei | 0:526a865b9b03 | 30 | } |
