LAB09_Oppgave1

Dependencies:   mbed

Fork of LAB08_Oppgave3 by Morten Madsen

Files at this revision

API Documentation at this revision

Comitter:
madmonkeyman82
Date:
Thu Oct 29 11:20:10 2015 +0000
Parent:
2:0dcac9edd3dc
Commit message:
f

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Oct 23 15:07:14 2015 +0000
+++ b/main.cpp	Thu Oct 29 11:20:10 2015 +0000
@@ -1,30 +1,22 @@
 #include "mbed.h"
 
 PwmOut servoMotor(PA_7);
+AnalogIn pot(PA_1);
+DigitalOut vcc(PA_0);
+DigitalOut gnd(PA_4);
 
 int main() 
 {    //sørg for å at servoMotor pulsen har en 
     //      Periode tid på .01 sek
+    vcc=1;
+    gnd=0;
+    
     servoMotor.period(0.010);
-    while (true) {
-        
-        for(int i = 1000; i <= 2100; i+= 10)
-        {
-           if(i == 2100)
-           {
-                for(; i >= 900; i-=10)
-                {
-                   servoMotor.pulsewidth_us(i); 
-                   wait_ms(5);
-                }
-            }
-           servoMotor.pulsewidth_us(i); 
+    
+    while (true) 
+    {
+          servoMotor = pot.read();
            wait_ms(5);
-        }
-        
-
-        
-        
     }
 }