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:
- 1:5c44e2462a8b
- Child:
- 2:dea0bab5e45c
diff -r 422088ad7fc5 -r 5c44e2462a8b liftAnsteuerung.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/liftAnsteuerung.cpp Wed May 10 14:48:50 2017 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+#include "cstdlib"
+#include "liftAnsteuerung.h"
+
+
+LiftAnsteuerung::LiftAnsteuerung(int zeitintervall, int ruecklaufzeit, Servo* servoLift)
+{
+ init(zeitintervall, ruecklauf, servoLift);
+}
+
+
+LiftAnsteuerung::LiftAnsteuerung() {}
+
+
+LiftAnsteuerung::~LiftAnsteuerung() {}
+
+
+void LiftAnsteuerung::init(int deltat, int rueck, Servo* servoLift)
+{
+ zeitintervall = deltat;
+ ruecklaufzeit = rueck;
+ this->servoLift = servoLift;
+ M1 = 0;
+ M2 = 0;
+}
+void LiftAnsteuerung::steuerung(int zeitintervall, int ruecklaufzeit, Servo* servoAusw){
+
+
+ if (M1<zeitintervall){
+ servoLift->write(1.1f);
+ M1++;
+
+ }
+ if (M1==zeitintervall){
+ M2=1;
+ }
+
+ if (M2<ruecklaufzeit){
+ servoLift->write(0.1f);
+ M2++;
+ }
+
+ if (M2==ruecklaufzeit){
+ M1=0;
+ M2=0;
+ }
+
+}
+void LiftAnsteuerung::setSerialOutput(Serial *pc)
+{
+ this->pc = pc;
+}
+
+
+