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:
- 5:4b409c37e81f
- Parent:
- 2:dea0bab5e45c
diff -r c1d1bcc96b14 -r 4b409c37e81f liftAnsteuerung.cpp
--- a/liftAnsteuerung.cpp Sat May 13 13:53:16 2017 +0000
+++ b/liftAnsteuerung.cpp Sun May 14 14:56:24 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,26 +17,29 @@
void LiftAnsteuerung::init(int interval, int ruecklauf, Servo* servoLift)
{
- zeitintervall = interval;
+ zeitinterval = interval;
ruecklaufzeit = ruecklauf;
this->servoLift = servoLift;
- M1 = 0;
+ M1 = interval;
M2 = ruecklauf;
+ //servoLift->write(1.2f);
}
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)
{
this->pc = pc;