![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
vf
Dependencies: Servo ServoArm mbed
Fork of PES_Official by
Sources/Leiste.cpp@17:4e1be70bdedb, 2017-05-18 (annotated)
- Committer:
- beacon
- Date:
- Thu May 18 14:27:09 2017 +0000
- Revision:
- 17:4e1be70bdedb
- Parent:
- 15:915f8839fe48
Si compila.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EpicG10 | 14:b61fbd13a7c9 | 1 | #include "Robot.h" |
EpicG10 | 14:b61fbd13a7c9 | 2 | #include "Declarations.h" |
EpicG10 | 14:b61fbd13a7c9 | 3 | |
EpicG10 | 14:b61fbd13a7c9 | 4 | |
EpicG10 | 14:b61fbd13a7c9 | 5 | Leiste::Leiste(){ |
EpicG10 | 14:b61fbd13a7c9 | 6 | } |
EpicG10 | 14:b61fbd13a7c9 | 7 | |
EpicG10 | 14:b61fbd13a7c9 | 8 | Leiste::Leiste(Servo* leiste){ |
EpicG10 | 14:b61fbd13a7c9 | 9 | init(leiste); |
EpicG10 | 14:b61fbd13a7c9 | 10 | } |
EpicG10 | 14:b61fbd13a7c9 | 11 | |
EpicG10 | 14:b61fbd13a7c9 | 12 | void Leiste::init(Servo* leiste){ |
EpicG10 | 14:b61fbd13a7c9 | 13 | this->leiste = leiste; |
EpicG10 | 15:915f8839fe48 | 14 | this->leiste->calibrate(0.0025f, 180.0f); |
EpicG10 | 14:b61fbd13a7c9 | 15 | this->leiste->position(UP_POS); |
EpicG10 | 14:b61fbd13a7c9 | 16 | } |
EpicG10 | 14:b61fbd13a7c9 | 17 | |
beacon | 17:4e1be70bdedb | 18 | int Leiste::upToDown(){ |
EpicG10 | 14:b61fbd13a7c9 | 19 | static float pos=UP_POS; |
EpicG10 | 14:b61fbd13a7c9 | 20 | if(pos>DOWN_POS) { |
EpicG10 | 14:b61fbd13a7c9 | 21 | pos-=3; |
EpicG10 | 14:b61fbd13a7c9 | 22 | this->leiste->position(pos); |
EpicG10 | 14:b61fbd13a7c9 | 23 | return 0; |
EpicG10 | 14:b61fbd13a7c9 | 24 | } |
EpicG10 | 14:b61fbd13a7c9 | 25 | else{ |
EpicG10 | 14:b61fbd13a7c9 | 26 | pos = UP_POS; |
EpicG10 | 14:b61fbd13a7c9 | 27 | return 1; |
EpicG10 | 14:b61fbd13a7c9 | 28 | } |
EpicG10 | 14:b61fbd13a7c9 | 29 | } |
EpicG10 | 14:b61fbd13a7c9 | 30 | |
beacon | 17:4e1be70bdedb | 31 | int Leiste::downToUp(){ |
EpicG10 | 14:b61fbd13a7c9 | 32 | static float pos=DOWN_POS; |
EpicG10 | 15:915f8839fe48 | 33 | if(pos<UP_POS) { |
EpicG10 | 15:915f8839fe48 | 34 | pos+=3; |
EpicG10 | 14:b61fbd13a7c9 | 35 | this->leiste->position(pos); |
EpicG10 | 14:b61fbd13a7c9 | 36 | return 0; |
EpicG10 | 14:b61fbd13a7c9 | 37 | } |
EpicG10 | 14:b61fbd13a7c9 | 38 | else{ |
EpicG10 | 14:b61fbd13a7c9 | 39 | pos = DOWN_POS; |
EpicG10 | 14:b61fbd13a7c9 | 40 | return 1; |
EpicG10 | 14:b61fbd13a7c9 | 41 | } |
EpicG10 | 14:b61fbd13a7c9 | 42 | } |