a
Dependents: 3servotest 1stcomp 3rdcompfixstart 2ndcomp ... more
Fork of Servo by
Diff: servo.cpp
- Revision:
- 3:c112df463a8d
- Parent:
- 1:c8ecfd809e22
- Child:
- 4:5ae6ed80dc46
diff -r c8ecfd809e22 -r c112df463a8d servo.cpp --- a/servo.cpp Wed Sep 07 09:40:58 2016 +0000 +++ b/servo.cpp Thu Sep 08 10:07:15 2016 +0000 @@ -28,17 +28,21 @@ } -void beltdegree(int degree) { - int i; +void beltup(void){ pwmarm.period_ms(20); //20ms - - degree=10; - - i=500+degree*1900/180; - pwmbelt.write(i/PERIOD); + pwmbelt.write(0.05); } + +void beltdown(void){ + + pwmarm.period_ms(20); //20ms + pwmbelt.write(0.1); + +} + + void close_hand(void) { int i,degree; @@ -47,7 +51,7 @@ degree=175; i=500+degree*1900/180; - pwmhand.pulsewidth_us(i); + pwmhand.write(i/PERIOD); } @@ -57,7 +61,7 @@ pwmarm.period_ms(20); //20ms - degree=160; + degree=100; i=500+degree*1900/180; pwmarm.write(i/PERIOD);