s

Dependencies:   mbed

main.cpp

Committer:
Voldread
Date:
2015-10-22
Revision:
0:78f70f725dfd

File content as of revision 0:78f70f725dfd:

#include "mbed.h"
#include "PwmOut.h"

PwmOut servoMotor(PA_7);
AnalogIn pot(PA_1);
DigitalOut Vcc(PA_0);
DigitalOut Gnd(PA_4);

int main() 
{    
    Vcc=1;
    Gnd=0;
   servoMotor.period(.01);
    
    while (true) 
    {
    //float spenning=pot.read();
    float Pulsewidth=1000+pot.read()*1000;
    servoMotor.pulsewidth_us(Pulsewidth);
    wait_ms(1);
    }
}