zhaw_st16b_pes2_10
/
Test-Arm
c
main.cpp
- Committer:
- EpicG10
- Date:
- 2017-04-19
- Revision:
- 0:a2e39e1c3e1c
File content as of revision 0:a2e39e1c3e1c:
#include "Test-Arm.h" #include "mbed.h" #include <cstdlib> #include "Servo.h" Servo ServoArm(PA_6); Ticker t1; int targetPosition = 0; void driveServo() { static float pos = 45; if( pos > targetPosition) pos-= 0.1f; else pos+= 0.1f; ServoArm.position(pos); } int main() { ServoArm.calibrate(0.0015f, 180.0f); t1.attach( driveServo, 0.1f ); //Arm Armi; wait( 5.0f); while(1) { targetPosition = 45; wait( 2.0); targetPosition = 15; wait( 2.0); /* Armi.down(); wait(0.5); Armi.collect(); wait(0.5); Armi.back(); wait(0.5); Armi.backtocollect(); wait(0.5);*/ } }