Dependencies:   Farbsensor IRSensorLib PID_Control Servo mbed PixyLib

Committer:
ZHAW_Prometheus
Date:
Fri May 26 09:11:49 2017 +0000
Revision:
16:ad45ef4fee04
Parent:
15:26dbcd6ff48d
Vers. 26.05.2017 11:10

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 12:472b26872a42 5 //Konstruktor
ZHAW_Prometheus 15:26dbcd6ff48d 6 LiftAnsteuerung::LiftAnsteuerung(uint8_t interval, uint8_t ruecklauf, Servo& _servoLift) : servoLift(_servoLift)
ZHAW_Prometheus 1:5c44e2462a8b 7 {
ZHAW_Prometheus 7:5949f408b6da 8 zeitinterval = interval;
ZHAW_Prometheus 2:dea0bab5e45c 9 ruecklaufzeit = ruecklauf;
ZHAW_Prometheus 7:5949f408b6da 10 M1 = interval;
ZHAW_Prometheus 2:dea0bab5e45c 11 M2 = ruecklauf;
ZHAW_Prometheus 1:5c44e2462a8b 12 }
ZHAW_Prometheus 12:472b26872a42 13 //Destruktor
ZHAW_Prometheus 12:472b26872a42 14 LiftAnsteuerung::~LiftAnsteuerung() {}
ZHAW_Prometheus 12:472b26872a42 15
ZHAW_Prometheus 15:26dbcd6ff48d 16 void LiftAnsteuerung::steuerung()
ZHAW_Prometheus 15:26dbcd6ff48d 17 {
ZHAW_Prometheus 15:26dbcd6ff48d 18 if (M1>0) {
ZHAW_Prometheus 15:26dbcd6ff48d 19 servoLift = 1.2f;
ZHAW_Prometheus 15:26dbcd6ff48d 20 M1--;
ZHAW_Prometheus 15:26dbcd6ff48d 21 } else if (M2>0) {
ZHAW_Prometheus 7:5949f408b6da 22
ZHAW_Prometheus 15:26dbcd6ff48d 23 servoLift = 0.1f;
ZHAW_Prometheus 15:26dbcd6ff48d 24 M2--;
ZHAW_Prometheus 15:26dbcd6ff48d 25 } else {
ZHAW_Prometheus 15:26dbcd6ff48d 26 M1 = zeitinterval;
ZHAW_Prometheus 15:26dbcd6ff48d 27 M2 = ruecklaufzeit;
ZHAW_Prometheus 12:472b26872a42 28 }
ZHAW_Prometheus 1:5c44e2462a8b 29 }
ZHAW_Prometheus 15:26dbcd6ff48d 30
ZHAW_Prometheus 1:5c44e2462a8b 31
ZHAW_Prometheus 15:26dbcd6ff48d 32