RainbowTeam / Mbed 2 deprecated ProjectTheseus

Dependencies:   mbed

AutoDrive.cpp

Committer:
Alexander_Zuest
Date:
2018-04-29
Revision:
5:695c5531f65e
Parent:
2:cb6bae534500
Child:
14:0caa7b93af7a

File content as of revision 5:695c5531f65e:

#include "mbed.h"
#include "MotorDriver.h"
#include "ReadFinalLine.h"
#include "ReadSensor.h"
#include "Mapping.h"
#include "AutoDrive.h"
#include "RouteCalculation.h" 
    
    int action = 0;
    int speed = 3;
    int placeholder = 1;
    void AutoDrive(const int route[]){
        
    while(route[action] != 100){
        
        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 + 1;    
    }
    printf("The target destination has been sucessfully reached!");
    
    }