servo unlock

Dependencies:   Servo mbed

Fork of Servo_HelloWorld by Simon Ford

main.cpp

Committer:
dll7
Date:
2017-06-07
Revision:
5:1f3b689130af
Parent:
4:ea67df2060cd

File content as of revision 5:1f3b689130af:

// Hello World to sweep a servo through its full range

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

Servo servo(D6);
InterruptIn button(D8);
Serial pc(USBTX, USBRX); // tx, rx

int main() {
    printf("start Office Key system\n");
 
    float range = 0.0008;
    
    servo = 0.9;
    
    servo.calibrate(range, 45.0);
    while(true){
        pc.getc();
        servo = 0.2;
        printf("open");
        printf(".");
        wait(1);
        servo = 0.9;
        printf("close\n");
    }
}