Dependencies:   Farbsensor IRSensorLib PID_Control Servo mbed PixyLib

Committer:
ZHAW_Prometheus
Date:
Sat May 20 12:01:27 2017 +0000
Revision:
10:10bcb7fee9a6
Parent:
9:b83994ef4b08
Child:
12:472b26872a42
Vers. 20.05.2017 14:00

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ZHAW_Prometheus 0:422088ad7fc5 1 #ifndef FAHREN_H
ZHAW_Prometheus 0:422088ad7fc5 2 #define FAHREN_H
ZHAW_Prometheus 0:422088ad7fc5 3
ZHAW_Prometheus 7:5949f408b6da 4
ZHAW_Prometheus 0:422088ad7fc5 5 #include <mbed.h>
ZHAW_Prometheus 0:422088ad7fc5 6 #include <cstdlib>
ZHAW_Prometheus 0:422088ad7fc5 7 #include "IRSensor.h"
ZHAW_Prometheus 8:077d0bb213a2 8 //#include "CamAusw.h"
ZHAW_Prometheus 8:077d0bb213a2 9 #include "Pixy.h"
ZHAW_Prometheus 8:077d0bb213a2 10 #include "PID_Control.h"
ZHAW_Prometheus 10:10bcb7fee9a6 11 #include "Button.h"
ZHAW_Prometheus 0:422088ad7fc5 12
ZHAW_Prometheus 0:422088ad7fc5 13 class Fahren
ZHAW_Prometheus 0:422088ad7fc5 14 {
ZHAW_Prometheus 0:422088ad7fc5 15 public:
ZHAW_Prometheus 0:422088ad7fc5 16
ZHAW_Prometheus 0:422088ad7fc5 17 //Konstruktoren und Destruktoren
ZHAW_Prometheus 10:10bcb7fee9a6 18 Fahren(DigitalOut* enable, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, AnalogIn* distance, DigitalOut* enableMotorDriver, PwmOut& pwmLeft, PwmOut& pwmRight, Pixy& pixy, PID_Control& pid, Button& onoff);
ZHAW_Prometheus 0:422088ad7fc5 19 Fahren();
ZHAW_Prometheus 0:422088ad7fc5 20 virtual ~Fahren();
ZHAW_Prometheus 0:422088ad7fc5 21
ZHAW_Prometheus 0:422088ad7fc5 22 //Public Methoden
ZHAW_Prometheus 9:b83994ef4b08 23 void init(DigitalOut* enable, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, AnalogIn* distance, DigitalOut* enableMotorDriver);
ZHAW_Prometheus 0:422088ad7fc5 24 void setSerialOutput(Serial *pc);
ZHAW_Prometheus 0:422088ad7fc5 25 int getState();
ZHAW_Prometheus 0:422088ad7fc5 26 void fahrInit();
ZHAW_Prometheus 0:422088ad7fc5 27 void fahrRutine();
ZHAW_Prometheus 0:422088ad7fc5 28
ZHAW_Prometheus 0:422088ad7fc5 29 private:
ZHAW_Prometheus 0:422088ad7fc5 30 //Private Methoden
ZHAW_Prometheus 0:422088ad7fc5 31
ZHAW_Prometheus 0:422088ad7fc5 32
ZHAW_Prometheus 0:422088ad7fc5 33 //Private Eigenschaften
ZHAW_Prometheus 7:5949f408b6da 34 IRSensor sensors[6];
ZHAW_Prometheus 7:5949f408b6da 35 DigitalOut* enable;
ZHAW_Prometheus 7:5949f408b6da 36 DigitalOut* bit0;
ZHAW_Prometheus 7:5949f408b6da 37 DigitalOut* bit1;
ZHAW_Prometheus 7:5949f408b6da 38 DigitalOut* bit2;
ZHAW_Prometheus 7:5949f408b6da 39 AnalogIn* distance;
ZHAW_Prometheus 7:5949f408b6da 40 DigitalOut* enableMotorDriver;
ZHAW_Prometheus 9:b83994ef4b08 41 PwmOut& pwmLeft;
ZHAW_Prometheus 9:b83994ef4b08 42 PwmOut& pwmRight;
ZHAW_Prometheus 9:b83994ef4b08 43 Pixy& pixy;
ZHAW_Prometheus 9:b83994ef4b08 44 PID_Control& pid;
ZHAW_Prometheus 10:10bcb7fee9a6 45 Button& onoff;
ZHAW_Prometheus 0:422088ad7fc5 46
ZHAW_Prometheus 0:422088ad7fc5 47 int state;
ZHAW_Prometheus 0:422088ad7fc5 48 enum state {gerade=0,rechts,links,drehen,zurueck,zurueck_l,zurueck_r};
ZHAW_Prometheus 0:422088ad7fc5 49 Serial *pc;
ZHAW_Prometheus 8:077d0bb213a2 50 float e;
ZHAW_Prometheus 8:077d0bb213a2 51 float diff;
ZHAW_Prometheus 9:b83994ef4b08 52 int serialTimer;
ZHAW_Prometheus 0:422088ad7fc5 53 //Konstante
schuema4 3:017c85c4b14b 54 static const double wenden =0.22;
ZHAW_Prometheus 0:422088ad7fc5 55 static const double wand =0.07;
ZHAW_Prometheus 0:422088ad7fc5 56 };
ZHAW_Prometheus 0:422088ad7fc5 57
ZHAW_Prometheus 0:422088ad7fc5 58 #endif