Colour sensors calibrated

Dependencies:   mbed-rtos mbed Servo QEI

Fork of ICRSEurobot13 by Thomas Branch

Revision:
4:1be0f6c6ceae
Parent:
3:717de74f6ebd
Child:
5:56a5fdd373c9
--- a/Sensors/Colour/Colour.h	Mon Apr 01 15:33:48 2013 +0000
+++ b/Sensors/Colour/Colour.h	Wed Apr 03 17:54:53 2013 +0000
@@ -1,7 +1,6 @@
 
 // Eurobot13 Colour.h
 
-
 #include "mbed.h"
 #include "Led.h"
 #include "Phototransistor.h"
@@ -45,32 +44,7 @@
 
 private:
     void LedsOff(){blue.off(); red.off();}
-    void ReadLed (Led &led, float &avg, float &stdev, const int measureNum = 25){
-        LedsOff(); led.on();
-        double x = 0, x2 = 0;
-        for (int i = measureNum; i != 0; i--){
-            float v = pt.read();
-            x += v;
-            x2+= v*v;
-        }
-        avg = x / measureNum;
-        stdev = sqrt(x2 / measureNum - avg*avg);
-        LedsOff();
-        
-        pc.printf("Phototransistor Analog is: %f\t%f\n\r", avg, stdev);
-    }
+    void ReadLed (Led &led, float &avg, float &stdev, const int measureNum = 25); // Colour.cpp
+    bool isColour(Led &led, const float &avg, const float &stdev, const float numstddev = 2); // Colour.cpp
     
-    bool isColour(Led &led, const float &avg, const float &stdev, const float numstddev = 2 ){
-        float avg2, stdev2;
-        ReadLed(led, avg2, stdev2);
-        
-        if (avg + numstddev*stdev < avg2 - numstddev*stdev2){
-            return true;
-        } else {
-            return false;
-        }
-    }
-    
-
-
 };
\ No newline at end of file