hello

Dependencies:   mbed-rtos mbed

Fork of BX-car by kao yi

Revision:
9:33b99cb45e99
Parent:
1:82bc25a7b68b
Child:
10:9f0ce6ba7663
Child:
11:03d5aa2511c4
--- a/servo_api.cpp	Sun Jun 22 15:29:20 2014 +0000
+++ b/servo_api.cpp	Tue Jun 24 10:06:54 2014 +0000
@@ -3,9 +3,9 @@
 #include "servo_api.h"
 
 
-#define right_end 0.05  //90
+#define right_end 0.06  //90
 
-#define left_end 0.1    //-90
+#define left_end 0.11    //-90
 
 //memory opt
 // 5 degree seperate
@@ -21,13 +21,7 @@
       
       servo_in->period_ms(20);
           
-      for(int i=0;i<37;i++){
-          
-          angle_level[i]=i*(0.05/36)+right_end;
-          }
-
-      *servo_in =angle_level[18];
-      
+    
     
     }
 
@@ -36,12 +30,17 @@
 
 
 
-int BX_servo::set_angle(int a){
+float BX_servo::set_angle(float a){
+    
+    if(a > left_end)
+        a=0.11;
+    else if(a< 0.06)
+        a=0.06;    
     
     
       angle=a;
        
-      *servo_in=angle_level[18+a/5];
+      *servo_in=angle;