group14 - k9 / Mbed 2 deprecated servo_test

Dependencies:   mbed Servo

Revision:
2:9bb7e571b55f
Parent:
1:c6e4257722b9
--- a/main.cpp	Fri Oct 23 10:06:36 2015 +0000
+++ b/main.cpp	Tue Oct 27 09:51:06 2015 +0000
@@ -1,26 +1,26 @@
 #include "mbed.h"
-#include "math.h" 
+#include "math.h"
+#include "Servo.h" 
 
 //servo ranges from .6ms to 2.7ms duty cycle in 20ms pwm period
 
-PwmOut servoPwm(D5);
+Servo servoPwm(D5);
 
 double theta1;
 double theta2;
 double theta3;
-double servoPwm.pulsewidth;
 
 Ticker servo;
  
      void servo_control()
 {
      theta3 = 180 - theta1 - theta2;
-     servoPwm.pulsewidth = (0.0021/180)*theta3 + 0.0006;
+     servoPwm.SetPosition = (2100/180)*theta3 + 600;
      }
 
 int main() 
 {   
-      servoPwm.period(0.020);
+      servoPwm.Enable(1650,20000);
         servo.attach(&servo_control,0,02);
         while(true){}
         }