![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
First commit at here
Dependencies: mbed Servo Motornew
Diff: main.cpp
- Revision:
- 4:3db9524b9b63
- Parent:
- 3:d1860dee0552
- Child:
- 5:832f5a808578
diff -r d1860dee0552 -r 3db9524b9b63 main.cpp --- a/main.cpp Tue Apr 16 12:57:01 2019 +0000 +++ b/main.cpp Sat May 11 04:44:45 2019 +0000 @@ -8,26 +8,28 @@ 21 22 1 */ -Servo servo1(D9); -//Servo servo2(PB_6); -Serial pc(D1, D0); +//PwmOut servo1(PB_7); +Servo servo1(PB_7); +Serial pc(USBTX,USBRX); int main() { pc.baud(9600); pc.printf("test begin\n"); //tes - servo1.calibrate(0.0003,150); + servo1.calibrate(0.001,120); //servo2.calibrate(0.001,150); - float f=0.8; + float f=0; //servo2.write(1.0); while(1){ - servo1.write(f); - pc.printf("input (1..10) bakal dijadiin persen : "); - pc.scanf("%f",&f); - pc.printf("\n"); - //float f = (float)n/(float)10; - pc.printf("%f", servo1.read()); - pc.printf("\n"); + servo1.position(f-62); + //servo1.pulsewidth_ms(f); //pc.printf("input (1..10) bakal dijadiin persen : "); + pc.printf("input (1..360) bakal dijadiin derajat : "); + pc.scanf("%f\n",&f); + //pc.printf("\n"); +// float f = (float)n/(float)10; + pc.printf("%f\n",&f); + //pc.printf("\n"); + } }