servo

Dependencies:   mbed

Fork of Timer_HelloWorld by mbed official

main.cpp

Committer:
godai0505
Date:
2015-12-09
Revision:
1:64fc7f117c1c
Parent:
0:27e1de20d3cb

File content as of revision 1:64fc7f117c1c:

#include "mbed.h"
 
Timer t;
Serial pc(USBTX,USBRX);
InterruptIn ch(p18);
PwmOut servo(p26);
//AnalogIn ain(p18);

double t_read;

void t_start(){
    t.start();
}
void t_stop(){
    t.stop();
    t_read = t.read();
    t.reset();
}

int main(void){
    
    pc.baud(115200);
    
    ch.rise(&t_start);
    ch.fall(&t_stop);
    
//    while(1){
//    pc.printf("%f\r\n",t_read);
//    }
    
    servo.pulsewidth();
}