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.
main.cpp
00001 #include "mbed.h" 00002 #include "PwmOut.h" 00003 PwmOut servo (A1); 00004 00005 int main() 00006 { 00007 int i=0; 00008 int v=1; 00009 servo.period_ms(20); // es constante 00010 00011 while(1) 00012 { 00013 // movimiento velocidad 00014 00015 00016 wait_ms(700); 00017 00018 v=100;// tiempo entre pasos, a mas tiempo mas lento se mueve si es 0 max velocidad 00019 00020 for(i=0;i<=18;i=i++) 00021 { 00022 wait_ms(v); 00023 servo.pulsewidth_us(640+(43*i));// va a aumentar desde 640(0 grados) de a 43(5 grados), hasta llegar a 1414(90 grados) 00024 } 00025 wait_ms(300); 00026 for(i=0;i<=18;i=i++) 00027 { 00028 wait_ms(v); 00029 servo.pulsewidth_us(1414-(43*i));// va disminuir desde 1414(90 grados) de a 43(5 grados), hasta llegar a 640 (0 grados) 00030 } 00031 00032 wait_ms(700); 00033 00034 00035 } 00036 }
Generated on Fri Jul 22 2022 02:07:30 by
1.7.2