![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Diff: main.cpp
- Revision:
- 0:b87696259aa1
diff -r 000000000000 -r b87696259aa1 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Dec 16 19:08:43 2016 +0000 @@ -0,0 +1,34 @@ +#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); + } +}