aaa

Dependencies:   mbed

Fork of RobotV1 by Gerardo Carmona

Revision:
2:aae3b2c0881c
Parent:
1:1bea5dcd4d6f
Child:
3:07a21d1d16e4
--- a/main.cpp	Wed Dec 02 23:15:39 2015 +0000
+++ b/main.cpp	Thu Dec 17 18:24:42 2015 +0000
@@ -2,7 +2,7 @@
 #include "Servo.h"
 
 #define MAXVEL      100  // From 100 max
-#define SERINC      0.1   // Move micro seconds up/down
+#define SERINC      100   // Move micro seconds up/down
 
 
 DigitalOut myled(LED1);
@@ -30,6 +30,7 @@
             c = bt.getc();
             pc.printf("Received: %c\n\r", c);
             decodeInstruction(c);
+            printf("%c\n", c);
         }
             
     }
@@ -88,11 +89,12 @@
 }
 
 void moveServo(int increment){
-    pc.printf("%f\n\r", SARM);
-    if (increment < 0 && SARM >= abs(increment)){
-        SARM = SARM + increment;
-    }else if (increment > 0 && SARM <= 1 - abs(increment)){
-        SARM = SARM + increment;
+    float temp = 0.0;
+    temp = (float)increment / 100.0;
+    if (temp < 0 && SARM >= abs(temp)){
+        SARM = SARM + temp;
+    }else if (temp > 0 && SARM <= 1 - abs(temp)){
+        SARM = SARM + temp;
     }
 }