First commit at here

Dependencies:   mbed Servo Motornew

Committer:
D4n1elR
Date:
Sun May 12 14:18:11 2019 +0000
Revision:
5:832f5a808578
Parent:
4:3db9524b9b63
Child:
6:38fb058f5827
For calibration

Who changed what in which revision?

UserRevisionLine numberNew contents of line
harrymunli 0:9dfae2e18414 1 #include "mbed.h"
harrymunli 0:9dfae2e18414 2 #include "Servo.h"
harrymunli 0:9dfae2e18414 3 #include "Motor.h"
harrymunli 0:9dfae2e18414 4
harrymunli 0:9dfae2e18414 5 /* Nama servo
harrymunli 0:9dfae2e18414 6 4
harrymunli 0:9dfae2e18414 7 3
harrymunli 0:9dfae2e18414 8 21 22
harrymunli 0:9dfae2e18414 9 1 */
harrymunli 0:9dfae2e18414 10
D4n1elR 4:3db9524b9b63 11 //PwmOut servo1(PB_7);
D4n1elR 4:3db9524b9b63 12 Servo servo1(PB_7);
D4n1elR 4:3db9524b9b63 13 Serial pc(USBTX,USBRX);
harrymunli 0:9dfae2e18414 14
harrymunli 0:9dfae2e18414 15 int main() {
harrymunli 1:9284c57e84da 16 pc.baud(9600);
harrymunli 1:9284c57e84da 17 pc.printf("test begin\n");
harrymunli 0:9dfae2e18414 18
harrymunli 1:9284c57e84da 19 //tes
D4n1elR 4:3db9524b9b63 20 servo1.calibrate(0.001,120);
harrymunli 3:d1860dee0552 21 //servo2.calibrate(0.001,150);
D4n1elR 4:3db9524b9b63 22 float f=0;
harrymunli 3:d1860dee0552 23 //servo2.write(1.0);
harrymunli 1:9284c57e84da 24 while(1){
D4n1elR 5:832f5a808578 25 servo1.position((f+51)*1.10);
D4n1elR 4:3db9524b9b63 26 //servo1.pulsewidth_ms(f); //pc.printf("input (1..10) bakal dijadiin persen : ");
D4n1elR 4:3db9524b9b63 27 pc.printf("input (1..360) bakal dijadiin derajat : ");
D4n1elR 4:3db9524b9b63 28 pc.scanf("%f\n",&f);
D4n1elR 4:3db9524b9b63 29 //pc.printf("\n");
D4n1elR 4:3db9524b9b63 30 // float f = (float)n/(float)10;
D4n1elR 4:3db9524b9b63 31 pc.printf("%f\n",&f);
D4n1elR 4:3db9524b9b63 32 //pc.printf("\n");
D4n1elR 4:3db9524b9b63 33
harrymunli 1:9284c57e84da 34 }
harrymunli 0:9dfae2e18414 35 }