David's dead reckoning code for the LVBots competition on March 6th. Uses the mbed LPC1768, DRV8835, QTR-3RC, and two DC motors with encoders.

Dependencies:   PololuEncoder Pacer mbed GeneralDebouncer

Revision:
24:fc01d9125d3b
Parent:
22:44c032e59ff5
Child:
28:4374035df5e0
--- a/test.cpp	Fri Feb 28 00:23:00 2014 +0000
+++ b/test.cpp	Fri Feb 28 01:07:14 2014 +0000
@@ -107,11 +107,12 @@
     }
 }
 
-// If the calibration stops working, we could just use these values from David's office in the day time:
+// Values from David's office     Values from dev lab,
+// in the day time, 2014-02-27:   2014-02-27:
 // #  calmin calmax
-// 0  34872 59726
-// 1  29335 60110
-// 2  23845 58446
+// 0  34872 59726                 0  40617 60222
+// 1  29335 60110                 1  36937 61198
+// 2  23845 58446                 2  33848 58862
 void testCalibrate()
 {
     Timer timer;
@@ -119,11 +120,26 @@
     
     Pacer reportPacer(200000);
     
+    bool doneCalibrating = false;
+    
+    led1 = 1;
+    
     while(1)
     {
         lineTracker.read();
-        lineTracker.updateCalibration();
-        led4 = calibrationLooksGood();
+        if(!doneCalibrating)
+        {
+            lineTracker.updateCalibration();
+        }
+
+        led2 = calibrationLooksGood();
+        led3 = doneCalibrating;
+        led4 = lineTracker.getLineVisible();
+        
+        if (button1DefinitelyPressed())
+        {
+            doneCalibrating = true;
+        }
         
         if (reportPacer.pace())
         {