fatboyslim / Mbed 2 deprecated buttontest

Dependencies:   FRDM-TFC mbed

Files at this revision

API Documentation at this revision

Comitter:
mperella
Date:
Tue Mar 10 16:57:23 2015 +0000
Parent:
42:c189b914931d
Commit message:
think the linescan stuff might be right

Changed in this revision

newAlgorithm.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/newAlgorithm.cpp	Tue Mar 10 15:51:02 2015 +0000
+++ b/newAlgorithm.cpp	Tue Mar 10 16:57:23 2015 +0000
@@ -113,14 +113,17 @@
             if (TFC_LineScanImageReady !=0) 
             {
                 // first image
-                position = getSensorValues(image); // get position
+                if(CurrentLineScanChannel)
+                {
+                    position = getSensorValues(true); // get position
+                }
+                // second image
+                else
+                {
+                    position = getSensorValues(false);
+                }
                 error = pid_calc(position); // send position to PID algorithm to get error
                 calcMotors(error); // send error to calculate both motors
-                
-                // second image
-                position = getSensorValues(image);
-                error = pid_calc(position);
-                calcMotors(error);
             }
         }
         else
@@ -135,26 +138,23 @@
         {
             for (uint16_t i=0; i<128; i++) 
             {
-                if ((*(TFC_LineScanImage1+i) < 250)) 
+                if ((*(TFC_LineScanImage0+i) < 250)) 
                 {
                     black_values_list[black_value_count] = i;
                     black_value_count++;
                 }
             }
-            
-            image = false;
         }
         else
         {
             for (uint16_t i=0; i<128; i++)
             {
-                if ((*(TFC_LineScanImage0+i) < 250))
+                if ((*(TFC_LineScanImage1+i) < 250))
                 {
                     black_values_list[black_value_count] = i;
                     black_value_count++;
                 }
             }
-            image = true;
         }
 
         for(int i=0; i<black_value_count; i++)