Gets user Input to turn the servo to certain degrees

Dependencies:   mbed

Revision:
7:78973b67cd90
Parent:
6:27284b61ae0c
--- a/servo.cpp	Sun Jan 13 22:33:48 2019 +0000
+++ b/servo.cpp	Mon Jan 14 00:35:57 2019 +0000
@@ -1,23 +1,22 @@
 #include "servo.h"
 PwmOut servo(p21);
 
-void setServo();
-    servo.period(0.020);
+void setServo(){
     servo.pulsewidth_us(1500);
     wait(2);
     }
     
 void moveServo(char a){
     switch(a){
-        case 1: servo.pulsdewidth_us(pulsewidth(-90)); break;
-        case 2: servo.pulsdewidth_us(pulsewidth(-67.5)); break;
-        case 3: servo.pulsdewidth_us(pulsewidth(-45)); break;
-        case 4: servo.pulsdewidth_us(pulsewidth(-22.5)); break;
-        case 5: servo.pulsdewidth_us(pulsewidth(0)); break;
-        case 6: servo.pulsdewidth_us(pulsewidth(22.5)); break;
-        case 7: servo.pulsdewidth_us(pulsewidth(45)); break;
-        case 8: servo.pulsdewidth_us(pulsewidth(67.5)); break;
-        case 9: servo.pulsdewidth_us(pulsewidth(90)); break;
+        case 1: servo.pulsewidth_us(pulsewidth(-90)); break;
+        case 2: servo.pulsewidth_us(pulsewidth(-67.5)); break;
+        case 3: servo.pulsewidth_us(pulsewidth(-45)); break;
+        case 4: servo.pulsewidth_us(pulsewidth(-22.5)); break;
+        case 5: servo.pulsewidth_us(pulsewidth(0)); break;
+        case 6: servo.pulsewidth_us(pulsewidth(22.5)); break;
+        case 7: servo.pulsewidth_us(pulsewidth(45)); break;
+        case 8: servo.pulsewidth_us(pulsewidth(67.5)); break;
+        case 9: servo.pulsewidth_us(pulsewidth(90)); break;
         }
     
     }