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
Diff: AutoDrive.cpp
- Revision:
- 0:4a0b987c5c94
- Child:
- 2:cb6bae534500
diff -r 000000000000 -r 4a0b987c5c94 AutoDrive.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/AutoDrive.cpp Fri Apr 27 12:30:38 2018 +0000
@@ -0,0 +1,31 @@
+ int action = 0;
+ int speed = 3;
+ autoDrive(const int route[][]){
+
+ while(route[action][0] != 0){
+
+ switch(route[action][0]){
+ case 1: // Fulldrive
+ driveOne(speed,route[action][1]);
+ break;
+
+ case 2: // turn Right
+ turnRight();
+ break;
+
+ case 3: // turn Left
+ turnLeft();
+ break;
+
+ case 4: // turn right on spot
+ trunRight();
+ break;
+
+ default: printf("Error: route could not be red!");
+ }
+
+ action = action + 1;
+ }
+ printf("The target destination has been sucessfully reached!");
+
+ }
\ No newline at end of file