vf
Dependencies: Servo ServoArm mbed
Fork of PES_Official by
Diff: Sources/Leiste.cpp
- Revision:
- 14:b61fbd13a7c9
- Child:
- 15:915f8839fe48
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sources/Leiste.cpp Wed May 10 19:53:08 2017 +0000 @@ -0,0 +1,42 @@ +#include "Robot.h" +#include "Declarations.h" + + +Leiste::Leiste(){ +} + +Leiste::Leiste(Servo* leiste){ + init(leiste); +} + +void Leiste::init(Servo* leiste){ + this->leiste = leiste; + this->leiste->calibrate(0.0015f, 180.0f); + this->leiste->position(UP_POS); +} + +int Leiste::UpToDown(){ + static float pos=UP_POS; + if(pos>DOWN_POS) { + pos-=3; + this->leiste->position(pos); + return 0; + } + else{ + pos = UP_POS; + return 1; + } +} + +int Leiste::DownToUp(){ + static float pos=DOWN_POS; + if(pos>UP_POS) { + pos-=3; + this->leiste->position(pos); + return 0; + } + else{ + pos = DOWN_POS; + return 1; + } +} \ No newline at end of file