Dependencies:   ServoOut mbed

main.cpp

Committer:
chuckwebb
Date:
2016-12-16
Revision:
0:b87696259aa1

File content as of revision 0:b87696259aa1:

#include "mbed.h"
#include "ServoOut.h"

DigitalOut myled(LED1);

Serial pc(USBTX, USBRX);

ServoOut servo1(p15);
ServoOut servo2(p16);
ServoOut servo3(p17);

int main() {
    char rx_str[100];
    float PW;
    
    while(1) {
        
        if(pc.readable())
        {  
            pc.scanf("%f*",&PW);
            
            pc.printf("Commanded pulse width: %f [microsec]\n",PW);
        }
        
        servo1.pulse_us = PW;
        servo2.pulse_us = PW;        
        servo3.pulse_us = PW; 
        
        myled = 1;
        wait(1);
        myled = 0;
        wait(1);
    }
}