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
Fork of Roboshark_V62 by
StateMachine.cpp
- Committer:
- ahlervin
- Date:
- 2018-05-03
- Revision:
- 6:7bbcdd07bc2d
- Parent:
- 0:6d0671ae4648
File content as of revision 6:7bbcdd07bc2d:
// Statemachine
//V04.18
// V. Ahlers
//Wird nicht mehr gebraucht
#include <mbed.h>
#include "StateMachine.h"
using namespace std;
StateMachine::StateMachine(int IrR, int IrL, int IrF) : IrR(IrR), IrL(IrL), IrF(IrF) {}
StateMachine::~StateMachine (){}
int StateMachine :: drive() {
if((IrR==0) && (IrL==0) && (IrF==1)){
caseDrive = 2; // Folge: 90 Grad nach rechts drehen
}else if ((IrR==0) && (IrL==1) && (IrF==0)){
caseDrive = 2; // Folge: 90 Grad nach rechts drehen
}else if ((IrR==0) && (IrL==1) && (IrF==1)){
caseDrive = 2; // Folge: 90 Grad nach rechts drehen
}else if ((IrR==1) && (IrL==0) && (IrF==0)){
caseDrive = 1; // Folge: geradeaus fahren
}else if ((IrR==1) && (IrL==0) && (IrF==1)){
caseDrive = 3; // Folge: 270 Grad nach rechts drehen
}else if ((IrR==1) && (IrL==1) && (IrF==0)){
caseDrive = 1; // Folge: geradeaus fahren
}else if ((IrR==1) && (IrL==1) && (IrF==1)){
caseDrive = 4; // Folge: 180 Grad nach rechts drehen
}else{ caseDrive=0;
}
return caseDrive;
}
