Prometheus / Mbed 2 deprecated Prom_Roebi

Dependencies:   Farbsensor IRSensorLib PID_Control Servo mbed PixyLib

Committer:
ZHAW_Prometheus
Date:
Sun May 14 14:56:24 2017 +0000
Revision:
5:4b409c37e81f
Parent:
2:dea0bab5e45c
Stand 14.05.17 16:56

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ZHAW_Prometheus 1:5c44e2462a8b 1 #include "mbed.h"
ZHAW_Prometheus 1:5c44e2462a8b 2 #include "cstdlib"
ZHAW_Prometheus 1:5c44e2462a8b 3 #include "liftAnsteuerung.h"
ZHAW_Prometheus 1:5c44e2462a8b 4
ZHAW_Prometheus 1:5c44e2462a8b 5
ZHAW_Prometheus 5:4b409c37e81f 6 LiftAnsteuerung::LiftAnsteuerung(int interval, int ruecklauf, Servo* servoLift)
ZHAW_Prometheus 1:5c44e2462a8b 7 {
ZHAW_Prometheus 5:4b409c37e81f 8 init(interval, ruecklauf, servoLift);
ZHAW_Prometheus 1:5c44e2462a8b 9 }
ZHAW_Prometheus 1:5c44e2462a8b 10
ZHAW_Prometheus 1:5c44e2462a8b 11
ZHAW_Prometheus 1:5c44e2462a8b 12 LiftAnsteuerung::LiftAnsteuerung() {}
ZHAW_Prometheus 1:5c44e2462a8b 13
ZHAW_Prometheus 1:5c44e2462a8b 14
ZHAW_Prometheus 1:5c44e2462a8b 15 LiftAnsteuerung::~LiftAnsteuerung() {}
ZHAW_Prometheus 1:5c44e2462a8b 16
ZHAW_Prometheus 1:5c44e2462a8b 17
ZHAW_Prometheus 2:dea0bab5e45c 18 void LiftAnsteuerung::init(int interval, int ruecklauf, Servo* servoLift)
ZHAW_Prometheus 1:5c44e2462a8b 19 {
ZHAW_Prometheus 5:4b409c37e81f 20 zeitinterval = interval;
ZHAW_Prometheus 2:dea0bab5e45c 21 ruecklaufzeit = ruecklauf;
ZHAW_Prometheus 1:5c44e2462a8b 22 this->servoLift = servoLift;
ZHAW_Prometheus 5:4b409c37e81f 23 M1 = interval;
ZHAW_Prometheus 2:dea0bab5e45c 24 M2 = ruecklauf;
ZHAW_Prometheus 5:4b409c37e81f 25 //servoLift->write(1.2f);
ZHAW_Prometheus 1:5c44e2462a8b 26 }
ZHAW_Prometheus 2:dea0bab5e45c 27 void LiftAnsteuerung::steuerung(){
ZHAW_Prometheus 5:4b409c37e81f 28 pc->printf("M1: %d, M2: %d\n\r", M1, M2);
ZHAW_Prometheus 5:4b409c37e81f 29 if (M1>0) {
ZHAW_Prometheus 5:4b409c37e81f 30 servoLift->write(1.2f);
ZHAW_Prometheus 5:4b409c37e81f 31 M1--;
ZHAW_Prometheus 5:4b409c37e81f 32 } else if (M2>0) {
ZHAW_Prometheus 2:dea0bab5e45c 33 servoLift->write(0.1f);
ZHAW_Prometheus 2:dea0bab5e45c 34 M2--;
ZHAW_Prometheus 2:dea0bab5e45c 35 } else {
ZHAW_Prometheus 5:4b409c37e81f 36 M1 = zeitinterval;
ZHAW_Prometheus 5:4b409c37e81f 37 M2 = ruecklaufzeit;
ZHAW_Prometheus 5:4b409c37e81f 38 }
ZHAW_Prometheus 5:4b409c37e81f 39 //pc->printf("M1: %d, M2: %d\n\r", M1, M2);
ZHAW_Prometheus 1:5c44e2462a8b 40 }
ZHAW_Prometheus 5:4b409c37e81f 41
ZHAW_Prometheus 5:4b409c37e81f 42
ZHAW_Prometheus 1:5c44e2462a8b 43 void LiftAnsteuerung::setSerialOutput(Serial *pc)
ZHAW_Prometheus 1:5c44e2462a8b 44 {
ZHAW_Prometheus 1:5c44e2462a8b 45 this->pc = pc;
ZHAW_Prometheus 1:5c44e2462a8b 46 }
ZHAW_Prometheus 1:5c44e2462a8b 47
ZHAW_Prometheus 1:5c44e2462a8b 48
ZHAW_Prometheus 1:5c44e2462a8b 49