zhaw_st16b_pes2_10 / Mbed 2 deprecated PES_Official-TestF

Dependencies:   Servo ServoArm mbed

Fork of PES_Official by zhaw_st16b_pes2_10

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Leiste.cpp Source File

Leiste.cpp

00001 #include "Robot.h"
00002 #include "Declarations.h"
00003 
00004 
00005 Leiste::Leiste(){
00006 }
00007 
00008 Leiste::Leiste(Servo* leiste){
00009     init(leiste);
00010 }
00011 
00012 void Leiste::init(Servo* leiste){
00013     this->leiste = leiste;
00014     this->leiste->calibrate(0.0025f, 180.0f);
00015     this->leiste->position(UP_POS);
00016 }
00017 
00018 int Leiste::upToDown(){
00019     static float pos=UP_POS;
00020     if(pos>DOWN_POS) {
00021         pos-=3;
00022         this->leiste->position(pos);
00023         return 0;
00024     }
00025     else{
00026         pos = UP_POS;
00027         return 1;
00028     }
00029 }
00030 
00031 int Leiste::downToUp(){
00032     static float pos=DOWN_POS;
00033     if(pos<UP_POS) {
00034         pos+=3;
00035         this->leiste->position(pos);
00036         return 0;
00037     }
00038     else{
00039         pos = DOWN_POS;
00040         return 1;
00041     }
00042 }