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: mbed
AutoDrive.cpp@0:4a0b987c5c94, 2018-04-27 (annotated)
- Committer:
- Alexander_Zuest
- Date:
- Fri Apr 27 12:30:38 2018 +0000
- Revision:
- 0:4a0b987c5c94
- Child:
- 2:cb6bae534500
Base Version
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Alexander_Zuest | 0:4a0b987c5c94 | 1 | int action = 0; |
| Alexander_Zuest | 0:4a0b987c5c94 | 2 | int speed = 3; |
| Alexander_Zuest | 0:4a0b987c5c94 | 3 | autoDrive(const int route[][]){ |
| Alexander_Zuest | 0:4a0b987c5c94 | 4 | |
| Alexander_Zuest | 0:4a0b987c5c94 | 5 | while(route[action][0] != 0){ |
| Alexander_Zuest | 0:4a0b987c5c94 | 6 | |
| Alexander_Zuest | 0:4a0b987c5c94 | 7 | switch(route[action][0]){ |
| Alexander_Zuest | 0:4a0b987c5c94 | 8 | case 1: // Fulldrive |
| Alexander_Zuest | 0:4a0b987c5c94 | 9 | driveOne(speed,route[action][1]); |
| Alexander_Zuest | 0:4a0b987c5c94 | 10 | break; |
| Alexander_Zuest | 0:4a0b987c5c94 | 11 | |
| Alexander_Zuest | 0:4a0b987c5c94 | 12 | case 2: // turn Right |
| Alexander_Zuest | 0:4a0b987c5c94 | 13 | turnRight(); |
| Alexander_Zuest | 0:4a0b987c5c94 | 14 | break; |
| Alexander_Zuest | 0:4a0b987c5c94 | 15 | |
| Alexander_Zuest | 0:4a0b987c5c94 | 16 | case 3: // turn Left |
| Alexander_Zuest | 0:4a0b987c5c94 | 17 | turnLeft(); |
| Alexander_Zuest | 0:4a0b987c5c94 | 18 | break; |
| Alexander_Zuest | 0:4a0b987c5c94 | 19 | |
| Alexander_Zuest | 0:4a0b987c5c94 | 20 | case 4: // turn right on spot |
| Alexander_Zuest | 0:4a0b987c5c94 | 21 | trunRight(); |
| Alexander_Zuest | 0:4a0b987c5c94 | 22 | break; |
| Alexander_Zuest | 0:4a0b987c5c94 | 23 | |
| Alexander_Zuest | 0:4a0b987c5c94 | 24 | default: printf("Error: route could not be red!"); |
| Alexander_Zuest | 0:4a0b987c5c94 | 25 | } |
| Alexander_Zuest | 0:4a0b987c5c94 | 26 | |
| Alexander_Zuest | 0:4a0b987c5c94 | 27 | action = action + 1; |
| Alexander_Zuest | 0:4a0b987c5c94 | 28 | } |
| Alexander_Zuest | 0:4a0b987c5c94 | 29 | printf("The target destination has been sucessfully reached!"); |
| Alexander_Zuest | 0:4a0b987c5c94 | 30 | |
| Alexander_Zuest | 0:4a0b987c5c94 | 31 | } |