Facundo Ramos
/
Servo_Motor
Servo
Diff: main.cpp
- Revision:
- 0:07bff9917d0d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Aug 26 15:30:54 2015 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" +#include "TSISensor.h" + +PwmOut servo(PTD5); +float t; + +int main() { + TSISensor tsi; + while(true) + { + t=(tsi.readPercentage()*0.002); + servo.period(0.020); //Periodo=20 mS + servo.pulsewidth(0.0005+t); //Hay que cambiar el ancho del pulso entre 1 y 2.5 mS para el Servo + wait(0.02); + + + } + } + \ No newline at end of file