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
- Committer:
- Alexander_Zuest
- Date:
- 2018-05-23
- Revision:
- 14:0caa7b93af7a
- Parent:
- 5:695c5531f65e
File content as of revision 14:0caa7b93af7a:
#include "mbed.h"
#include "MotorDriver.h"
#include "ReadFinalLine.h"
#include "ReadSensor.h"
#include "AutoDrive.h"
#include "RouteCalculation.h"
void autoDrive(char route[]){
int action = 0;
int speed = 3;
int placeholder = 1;
while(route[action] != 5){
switch(route[action]){
case 1: // Fulldrive
driveOne(speed,route[action+1]);
break;
case 2: // turn Right
turnRight(placeholder);
break;
case 3: // turn Left
turnLeft(placeholder);
break;
case 4: // turn right on spot
turnRight(placeholder);
break;
default: printf("Error: route could not be red!");
}
action = action + 2;
}
printf("The target destination has been sucessfully reached!");
}