fatboyslim / Mbed 2 deprecated buttontest

Dependencies:   FRDM-TFC mbed

Revision:
32:de2924b2ee54
Parent:
27:3dd1460365d3
--- a/main.cpp	Tue Mar 03 18:55:17 2015 +0000
+++ b/main.cpp	Tue Mar 03 19:00:26 2015 +0000
@@ -6,6 +6,8 @@
 #define CONSERVATIVE .35
 #define STOP 0
 #define BLACK_THRESHOLD 64
+#define MOTOR_THRESHOLD_UPPER .7
+#define MOTOR_THRESHOLD_LOWER -.7
 
 DigitalOut myled(LED1);
 
@@ -45,14 +47,14 @@
 
     int centers_List[100];
     
-    int center_now = 64;
-    int center_past_1 = 64;
-    int center_past_2 = 64;
-    int center_past_3 = 64;
-    int center_past_4 = 64;
+    int center_now = 63;
+    int center_past_1 = 63;
+    int center_past_2 = 63;
+    int center_past_3 = 63;
+    int center_past_4 = 63;
     //int best_guess_center = 64;
     
-    int set_point = 64;
+    int set_point = 63;
     int previous_error = 0;
     int error = 0;
 
@@ -116,14 +118,14 @@
             
 
             // protection block
-            if(current_left_motor_speed >= 0.5)
-                current_left_motor_speed= 0.5;
-            if(current_right_motor_speed >= 0.5)
-                current_right_motor_speed= 0.5;
-            if(current_left_motor_speed <= -0.5)
-                current_left_motor_speed= -0.5;
-            if(current_right_motor_speed <= -0.5)
-                current_right_motor_speed= -0.5;
+            if(current_left_motor_speed >= MOTOR_THRESHOLD_UPPER)
+                current_left_motor_speed= MOTOR_THRESHOLD_UPPER;
+            if(current_right_motor_speed >= MOTOR_THRESHOLD_UPPER)
+                current_right_motor_speed= MOTOR_THRESHOLD_UPPER;
+            if(current_left_motor_speed <= MOTOR_THRESHOLD_LOWER)
+                current_left_motor_speed= MOTOR_THRESHOLD_LOWER;
+            if(current_right_motor_speed <= MOTOR_THRESHOLD_LOWER)
+                current_right_motor_speed= MOTOR_THRESHOLD_LOWER;
 
             TFC_SetMotorPWM(current_left_motor_speed, current_right_motor_speed);
         }// end motor enabled
@@ -216,7 +218,7 @@
                             current_servo_position = -0.4;
                         TFC_SetServo(0, current_servo_position);
                         
-                        boolean listSame = true;
+                        bool listSame = true;
                         
                         /*
                         if(center_now + 5 < center_past_4 && center_now - 5 > center_past_4)
@@ -288,7 +290,7 @@
                             current_servo_position = +0.4;
                         TFC_SetServo(0, current_servo_position);
                         
-                        boolean listSame = true;
+                        bool listSame = true;
                         
                         /*
                         if(center_now + 5 < center_past_4 && center_now - 5 > center_past_4)