Do NOT modify!

Dependencies:   mbed Servo ServoArm

Fork of PES_Yanick by zhaw_st16b_pes2_10

Revision:
4:67d7177c213f
Parent:
3:fa61be4ecaa6
Child:
5:1aaf5de776ff
--- a/Headers/Robot.h	Wed Mar 22 13:33:07 2017 +0000
+++ b/Headers/Robot.h	Wed Apr 19 12:23:52 2017 +0000
@@ -3,26 +3,10 @@
 
 #include <cstdlib>
 #include <mbed.h>
+#include "Servo.h"
 
 #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
-
-//Misc:
-#define TIMEOUT 5
-
 
 /* Declarations for the Motors in the Robot in order to drive -------- */
 
@@ -30,10 +14,10 @@
 {
     public:
         
-        DistanceSensors(AnalogIn* sensorVoltage, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number);
+        DistanceSensors(AnalogIn* sensorVoltage, AnalogIn* frontS, AnalogIn* leftS, AnalogIn* rightS, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number);
         DistanceSensors();
         
-        void init(AnalogIn* sensorVoltage, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number);
+        void init(AnalogIn* sensorVoltage, AnalogIn* frontS, AnalogIn* leftS, AnalogIn* rightS, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number);
         virtual ~DistanceSensors();    
         float read();
         
@@ -42,6 +26,10 @@
     private:
         
         AnalogIn*       sensorVoltage;
+        AnalogIn*       frontS;
+        AnalogIn*       leftS;
+        AnalogIn*       rightS;
+        
         DigitalOut*     bit0;
         DigitalOut*     bit1;
         DigitalOut*     bit2;
@@ -65,6 +53,24 @@
     
         AnalogIn*   FarbVoltage;
 };
+/*
+class Arm{
+    
+    public:
+        Arm(Servo joint);
+        Arm();
+        void init(Servo joint);
+        
+        void down();
+        void neutral();
+        void back();
+        void setAngle(float angle);
+        
+    private:
+        Servo joint;
+        
+};
+*/
 
 class Robot
 {
@@ -72,17 +78,40 @@
     public:
         
         //Robot related:
-        Robot(PwmOut* left, PwmOut* right, DigitalOut* enableSignal, DigitalOut* leds, AnalogIn* FarbVoltage );
+        Robot(PwmOut* left, PwmOut* right, DigitalOut* enableSignal, DigitalOut* leds, AnalogIn* FarbVoltage,  AnalogIn* frontS, AnalogIn* leftS, AnalogIn* rightS );
+        
+        //Drive Functions
         void drive();
+        void driveB();
+
         void turnLeft();
+        void turnLeftS();
         void turnRight();
+        void turnRightS();
         void turnAround(int left);
         void stop();
         
-        void search(int* counter, Timer* t);
+        //Functions that use the drive functions
+        void wallRight(int* counter, int* timer, int* lastAct);
+        void wallLeft(int* counter, int* timer, int* lastAct);
+        void wallFront(int* counter, int* timer, int* lastAct);
+        void counterMax(int* counter, int* timer, int* lastAct, int* rando);
+        
+        void legoFront(int* counter, int* timer, int* lastAct, int* legoFound);
+        void legoRight(int* counter, int* timer, int* lastAct, int* legoFound);
+        void legoLeft(int* counter, int* timer, int* lastAct, int* legoFound);
+        
+        void nothingFound(int* counter, int* timer, int* lastAct);
+        
+        void search(int* counter, int* timer, int* found);
+        void lego(int* counter, Timer* t);
         
         //DistanceSensors related:
-        DistanceSensors sensors[6];
+        DistanceSensors sensors[9];
+        AnalogIn* frontS;
+        AnalogIn* leftS;
+        AnalogIn* rightS;
+        
         
         void initializeDistanceSensors();
         //void init();
@@ -103,6 +132,8 @@
         DigitalIn*      errorSignal;
         DigitalIn*      overtemperatur;
         
+        Servo*          arm;
+        
 
 };