a

Dependencies:   Servo ServoArm mbed

Fork of PES_Official-TestF by zhaw_st16b_pes2_10

Headers/Robot.h

Committer:
beacon
Date:
2017-03-11
Revision:
0:d267b248eff4
Child:
1:388c915756f5

File content as of revision 0:d267b248eff4:

#ifndef ROBOT_H
#define ROBOT_H

#include <cstdlib>
#include <mbed.h>

#include "mbed.h"


/* Declarations for the Motors in the Robot in order to drive -------- */
class Robot
{
    
    public:
        
        //Robot related:
        Robot(PwmOut* left, PwmOut* right, DigitalOut* enable);
        void drive();
        void turnLeft();
        void turnRight();
        void turnAround(int left);
        
        //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 init();
        
    private:
    
        //Robot related:
        PwmOut*         left;
        PwmOut*         right;
    
        DigitalOut*     powerSignal;
        DigitalIn*      errorSignal;
        DigitalIn*      overtemperatur;
        
        //Distance sensors related:
            //DistanceSensors   sensors[6];

};

#endif