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: Farbsensor IRSensorLib PID_Control Servo mbed PixyLib
Diff: liftAnsteuerung.cpp
- Revision:
- 7:5949f408b6da
- Parent:
- 2:dea0bab5e45c
- Child:
- 8:077d0bb213a2
--- a/liftAnsteuerung.cpp Tue May 16 14:02:23 2017 +0000
+++ b/liftAnsteuerung.cpp Wed May 17 07:38:41 2017 +0000
@@ -3,9 +3,9 @@
#include "liftAnsteuerung.h"
-LiftAnsteuerung::LiftAnsteuerung(int intervall, int ruecklauf, Servo* servoLift)
+LiftAnsteuerung::LiftAnsteuerung(int interval, int ruecklauf, Servo* servoLift)
{
- init(intervall, ruecklauf, servoLift);
+ init(interval, ruecklauf, servoLift);
}
@@ -17,24 +17,27 @@
void LiftAnsteuerung::init(int interval, int ruecklauf, Servo* servoLift)
{
- zeitintervall = interval;
+ zeitinterval = interval;
ruecklaufzeit = ruecklauf;
this->servoLift = servoLift;
- M1 = 0;
+ M1 = interval;
M2 = ruecklauf;
}
void LiftAnsteuerung::steuerung(){
- if (M1<zeitintervall && M2 == ruecklauf) {
- servoLift->write(1.1f);
- M1++;
- } else if (M1==zeitintervall && M2>=0) {
+ pc->printf("M1: %d, M2: %d\n\r", M1, M2);
+ if (M1>0) {
+ servoLift->write(1.2f);
+ M1--;
+ } else if (M2>0) {
+
servoLift->write(0.1f);
M2--;
} else {
- M1 = 0;
- M2 = zeitintervall;
- }
+ M1 = zeitinterval;
+ M2 = ruecklaufzeit;
+ }
+ //pc->printf("M1: %d, M2: %d\n\r", M1, M2);
}
void LiftAnsteuerung::setSerialOutput(Serial *pc)