LAB09_Oppgave1

Dependencies:   mbed

Fork of LAB09_Oppgave1 by Morten Madsen

Committer:
madmonkeyman82
Date:
Thu Oct 29 11:20:10 2015 +0000
Revision:
3:8a79c1dcefaa
Parent:
2:0dcac9edd3dc
f

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rlanghbv 0:6332c3bffb25 1 #include "mbed.h"
rlanghbv 0:6332c3bffb25 2
rlanghbv 0:6332c3bffb25 3 PwmOut servoMotor(PA_7);
madmonkeyman82 3:8a79c1dcefaa 4 AnalogIn pot(PA_1);
madmonkeyman82 3:8a79c1dcefaa 5 DigitalOut vcc(PA_0);
madmonkeyman82 3:8a79c1dcefaa 6 DigitalOut gnd(PA_4);
rlanghbv 0:6332c3bffb25 7
rlanghbv 0:6332c3bffb25 8 int main()
rlanghbv 0:6332c3bffb25 9 { //sørg for å at servoMotor pulsen har en
rlanghbv 0:6332c3bffb25 10 // Periode tid på .01 sek
madmonkeyman82 3:8a79c1dcefaa 11 vcc=1;
madmonkeyman82 3:8a79c1dcefaa 12 gnd=0;
madmonkeyman82 3:8a79c1dcefaa 13
madmonkeyman82 2:0dcac9edd3dc 14 servoMotor.period(0.010);
madmonkeyman82 3:8a79c1dcefaa 15
madmonkeyman82 3:8a79c1dcefaa 16 while (true)
madmonkeyman82 3:8a79c1dcefaa 17 {
madmonkeyman82 3:8a79c1dcefaa 18 servoMotor = pot.read();
madmonkeyman82 2:0dcac9edd3dc 19 wait_ms(5);
rlanghbv 0:6332c3bffb25 20 }
rlanghbv 0:6332c3bffb25 21 }
rlanghbv 0:6332c3bffb25 22
rlanghbv 0:6332c3bffb25 23
rlanghbv 0:6332c3bffb25 24
rlanghbv 1:e5f12ffcf32f 25