a
Dependencies: Servo ServoArm mbed
Fork of PES_Official-TestF by
Diff: Headers/Robot.h
- Revision:
- 0:d267b248eff4
- Child:
- 1:388c915756f5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Headers/Robot.h Sat Mar 11 10:14:00 2017 +0000 @@ -0,0 +1,67 @@ +#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 \ No newline at end of file