Boleh bisa langsung dicoba, tap servo base belum dikalibrasi

Dependencies:   mbed Servo

main.cpp

Committer:
harrymunli
Date:
2019-04-16
Revision:
3:d1860dee0552
Parent:
2:34ed8b55eba6
Child:
4:3db9524b9b63

File content as of revision 3:d1860dee0552:

#include "mbed.h"
#include "Servo.h"
#include "Motor.h"

/* Nama servo
    4
    3
  21 22
    1 */
    
Servo servo1(D9);
//Servo servo2(PB_6);
Serial pc(D1, D0);

int main() {
    pc.baud(9600);
    pc.printf("test begin\n");
    
    //tes
    servo1.calibrate(0.0003,150);
    //servo2.calibrate(0.001,150);
    float f=0.8;
    //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");
    }
}