s

Dependencies:   mbed

Fork of LAB08_Oppgave2 by EL-POM1001

Files at this revision

API Documentation at this revision

Comitter:
Voldread
Date:
Thu Oct 22 15:08:18 2015 +0000
Parent:
1:e5f12ffcf32f
Commit message:
s

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Oct 21 11:10:55 2015 +0000
+++ b/main.cpp	Thu Oct 22 15:08:18 2015 +0000
@@ -1,14 +1,25 @@
 #include "mbed.h"
+#include "PwmOut.h"
 
 PwmOut servoMotor(PA_7);
 
+
 int main() 
-{    //sørg for å at servoMotor pulsen har en 
+{    
+   servoMotor.period(.01);
+    //sørg for å at servoMotor pulsen har en 
     //      Periode tid på .01 sek
     while (true) {
+        
+        servoMotor=1;
+       servoMotor.pulsewidth_us(1000);
+        
         //Roter Servo hodet minus 60 grader
         //   servoMotor har pusbredde på 1000 us
         wait(0.2);
+       
+       servoMotor=2;
+         servoMotor.pulsewidth_us(2000);
         //Roter Servo hodet pluss 60 grader
         //   servoMotor har pusbredde på 2000 us
         wait(0.2);