Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Servo1.cpp
00001 #include "mbed.h" 00002 PwmOut servo(PTB0); 00003 DigitalIn gpo(PTC13); 00004 int main() { 00005 servo.period(0.020); // servo requires a 20ms period 00006 while (1) { 00007 // for(float offset=0.0; offset<0.001; offset+=0.0001) { 00008 if (gpo==1){ 00009 servo.pulsewidth(0.0006); // servo position determined by a pulsewidth between 1-2ms //0.0022 es maximo=180°, 0.0006 minimo=0°, medio 0.0014=90° 00010 //printf("%i",servo.pulsewidth); 00011 wait(0.25); 00012 } 00013 else 00014 { 00015 servo.pulsewidth(0.00145); 00016 wait(0.25); 00017 } 00018 } 00019 }
Generated on Sun Jul 17 2022 18:14:42 by
1.7.2