Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Servo ServoArm
Fork of PES_Yanick by
Diff: Headers/Robot.h
- Revision:
- 8:593f82e66bdf
- Parent:
- 6:ba26dd3251b3
- Child:
- 9:ac362674c480
diff -r ba26dd3251b3 -r 593f82e66bdf Headers/Robot.h
--- a/Headers/Robot.h Wed Apr 26 14:09:08 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-#ifndef ROBOT_H
-#define ROBOT_H
-
-#include <cstdlib>
-#include <mbed.h>
-#include "Servo.h"
-
-#include "mbed.h"
-
-
-/* Declarations for the Motors in the Robot in order to drive -------- */
-
-class DistanceSensors
-{
- public:
-
- DistanceSensors(AnalogIn* sensorVoltage, AnalogIn* frontS, AnalogIn* leftS, AnalogIn* rightS, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number);
- DistanceSensors();
-
- void init(AnalogIn* sensorVoltage, AnalogIn* frontS, AnalogIn* leftS, AnalogIn* rightS, 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;
- AnalogIn* frontS;
- AnalogIn* leftS;
- AnalogIn* rightS;
-
- 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 Arm{
-
- public:
-
- Arm();
- Arm(Servo* servoArm);
-
- void init(Servo* servoArm);
-
- void collecttodown(int* done);
- void downtocollect(int* done);
- void collecttoback(int* done);
- void backtocollect(int* done);
-
- private:
- Servo* servoArm;
- float angle;
-
-};
-
-class Robot
-{
-
- public:
-
- //Robot related:
- Robot(PwmOut* left, PwmOut* right, DigitalOut* enableSignal, DigitalOut* leds, AnalogIn* FarbVoltage, AnalogIn* frontS, AnalogIn* leftS, AnalogIn* rightS, Servo* Arm );
-
- //Drive Functions
- void drive();
- void driveB();
-
- void turnLeft();
- void turnLeftS();
- void turnRight();
- void turnRightS();
- void turnAround(int left);
- void stop();
-
- //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, int* found);
- 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[9];
- AnalogIn* frontS;
- AnalogIn* leftS;
- AnalogIn* rightS;
-
-
- void initializeDistanceSensors();
- //void init();
-
- //LEDS related:
- DigitalOut* leds;
-
- //Farbsensors related:
- Farbsensor FarbVoltage;
-
- //Arm related:
- Arm Arm;
-
- private:
-
- //Robot related:
- PwmOut* left;
- PwmOut* right;
-
- DigitalOut* powerSignal;
- DigitalIn* errorSignal;
- DigitalIn* overtemperatur;
-
- Servo* arm;
-
-
-};
-
-#endif
\ No newline at end of file
