s

Dependencies:   mbed

Committer:
Voldread
Date:
Thu Oct 22 15:08:34 2015 +0000
Revision:
0:78f70f725dfd
s

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Voldread 0:78f70f725dfd 1 #include "mbed.h"
Voldread 0:78f70f725dfd 2 #include "PwmOut.h"
Voldread 0:78f70f725dfd 3
Voldread 0:78f70f725dfd 4 PwmOut servoMotor(PA_7);
Voldread 0:78f70f725dfd 5 AnalogIn pot(PA_1);
Voldread 0:78f70f725dfd 6 DigitalOut Vcc(PA_0);
Voldread 0:78f70f725dfd 7 DigitalOut Gnd(PA_4);
Voldread 0:78f70f725dfd 8
Voldread 0:78f70f725dfd 9 int main()
Voldread 0:78f70f725dfd 10 {
Voldread 0:78f70f725dfd 11 Vcc=1;
Voldread 0:78f70f725dfd 12 Gnd=0;
Voldread 0:78f70f725dfd 13 servoMotor.period(.01);
Voldread 0:78f70f725dfd 14
Voldread 0:78f70f725dfd 15 while (true)
Voldread 0:78f70f725dfd 16 {
Voldread 0:78f70f725dfd 17 //float spenning=pot.read();
Voldread 0:78f70f725dfd 18 float Pulsewidth=1000+pot.read()*1000;
Voldread 0:78f70f725dfd 19 servoMotor.pulsewidth_us(Pulsewidth);
Voldread 0:78f70f725dfd 20 wait_ms(1);
Voldread 0:78f70f725dfd 21 }
Voldread 0:78f70f725dfd 22 }
Voldread 0:78f70f725dfd 23
Voldread 0:78f70f725dfd 24
Voldread 0:78f70f725dfd 25
Voldread 0:78f70f725dfd 26