Do NOT modify!

Dependencies:   mbed Servo ServoArm

Fork of PES_Yanick by zhaw_st16b_pes2_10

Revision:
1:388c915756f5
Parent:
0:d267b248eff4
Child:
2:01e9de508316
--- a/Headers/Robot.h	Sat Mar 11 10:14:00 2017 +0000
+++ b/Headers/Robot.h	Sun Mar 19 12:20:26 2017 +0000
@@ -6,48 +6,89 @@
 
 #include "mbed.h"
 
+//DistanceSensors:
+#define NEAR 0.1f           //Used for distance Sensors. If they're to near to a wall -> turn
+#define LEFT 5              //Arrayindex of the left Sensor & left LED
+#define FWD 0               //Arrayindex of the front Sensor & front LED
+#define RIGHT 1             //Arrayindex of the right Sensor & right LED.
+
+//ColorSensors:
+#define RED_UPLIMIT 500     //Default limit in mV
+#define GREEN_DOWNLIMIT 501 //Default limit in mV
+#define GREEN_UPLIMIT 1200  //Default limit in mV
+#define GREEN 1
+#define NOBLOCK 0
+#define RED -1
+
 
 /* Declarations for the Motors in the Robot in order to drive -------- */
+
+class DistanceSensors
+{
+    public:
+        
+        DistanceSensors(AnalogIn* sensorVoltage, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number);
+        DistanceSensors();
+        
+        void init(AnalogIn* sensorVoltage, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number);
+        virtual ~DistanceSensors();    
+        float read();
+        
+        operator float();           //Is here to constantly return the value of read.
+        
+    private:
+        
+        AnalogIn*       sensorVoltage;
+        DigitalOut*     bit0;
+        DigitalOut*     bit1;
+        DigitalOut*     bit2;
+        
+        int             number;
+
+};
+
+class Farbsensor
+{
+    public:
+     
+        Farbsensor();
+        Farbsensor(AnalogIn* FarbVoltage);
+    
+        void init(AnalogIn* FarbVoltage);
+        int read();
+        operator int();
+    
+    private:
+    
+        AnalogIn*   FarbVoltage;
+};
+
 class Robot
 {
     
     public:
         
         //Robot related:
-        Robot(PwmOut* left, PwmOut* right, DigitalOut* enable);
+        Robot(PwmOut* left, PwmOut* right, DigitalOut* enableSignal, DigitalOut* leds, AnalogIn* FarbVoltage );
         void drive();
         void turnLeft();
         void turnRight();
         void turnAround(int left);
+        void stop();
+        
+        void search(int* counter);
         
         //DistanceSensors related:
-        class DistanceSensors
-        {
-            public:
-                
-                DistanceSensors(AnalogIn* sensorVoltage, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number);
-                DistanceSensors();
-                
-                void init(AnalogIn* sensorVoltage, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number);
-                virtual ~DistanceSensors();    
-                float read();
-                
-                operator float();           //Is here to constantly return the value of read.
-                
-            private:
-                
-                AnalogIn*       sensorVoltage;
-                DigitalOut*     bit0;
-                DigitalOut*     bit1;
-                DigitalOut*     bit2;
-                
-                int             number;
-
-        };
+        DistanceSensors sensors[6];
+        
+        void initializeDistanceSensors();
+        //void init();
         
+        //LEDS related:
+        DigitalOut*      leds;
         
-        DistanceSensors sensors[6];
-        void init();
+        //Farbsensors related:
+        Farbsensor FarbVoltage;
         
     private:
     
@@ -59,8 +100,6 @@
         DigitalIn*      errorSignal;
         DigitalIn*      overtemperatur;
         
-        //Distance sensors related:
-            //DistanceSensors   sensors[6];
 
 };