Camilo Ramirez / Mbed 2 deprecated pruebaservo1

Dependencies:   mbed

main.cpp

Committer:
Camilokingxd
Date:
2018-03-10
Revision:
0:bfbe9528a949

File content as of revision 0:bfbe9528a949:

#include "mbed.h"
PwmOut sg90azul(PB_9);//SE NOMBRA OBJETO Y SE ESTABLECE PIN DEL OBJETO
DigitalOut ledgrande(LED1);//SE PROGRAMA EL LED A UTILIZAR 
int a=1,x=500;
int main() 
{ 
    sg90azul.period_ms(20);
    while (a<=18)
    {
        sg90azul.pulsewidth_us(x);
        wait_ms(1000);
        x=x+120;
        a++;
        if(a==18)
        {
            while(a>1)
            {
                sg90azul.pulsewidth_us(x);
                wait_ms(1000);
                x=x-120;
                a--; 
            }
        }
    }
}