David's line following code from the LVBots competition, 2015.

Dependencies:   GeneralDebouncer Pacer PololuEncoder mbed

Fork of DeadReckoning by David Grayson

Revision:
22:44c032e59ff5
Parent:
21:c279c6a83671
Child:
24:fc01d9125d3b
--- a/test.cpp	Thu Feb 27 23:20:34 2014 +0000
+++ b/test.cpp	Fri Feb 28 00:16:49 2014 +0000
@@ -107,6 +107,43 @@
     }
 }
 
+// If the calibration stops working, we could just use these values from David's office in the day time:
+// #  calmin calmax
+// 0  34872 59726
+// 1  29335 60110
+// 2  23845 58446
+void testCalibrate()
+{
+    Timer timer;
+    timer.start();
+    
+    Pacer reportPacer(200000);
+    
+    while(1)
+    {
+        lineTracker.read();
+        lineTracker.updateCalibration();
+        led4 = calibrationLooksGood();
+        
+        if (reportPacer.pace())
+        {
+            pc.printf("\x1B[0;0H");  // VT100 command for "go to 0,0"
+            for(uint8_t s = 0; s < LINE_SENSOR_COUNT; s++)
+            {
+                pc.printf("%-2d %5d %5d %5d\r\n", s, lineTracker.calibratedMinimum[s], lineTracker.rawValues[s], lineTracker.calibratedMaximum[s]);
+            }
+            if (calibrationLooksGood())
+            {
+                pc.puts("Good.        \r\n");
+            }
+            else
+            {
+                pc.puts("Not good yet.\r\n");   
+            }
+        }
+    }
+}
+
 void testEncoders()
 {
     Pacer reportPacer(500000);