tweaked detection to use photoresistor through an opamp

Dependents:   rgb_sensor_buffer

Fork of rgb_sensor by Milosch Meriac

Revision:
11:fea393d0d17a
Parent:
9:7bd80f4a965e
--- a/rgb_sensor.cpp	Thu Jul 03 17:24:41 2014 +0000
+++ b/rgb_sensor.cpp	Fri Mar 20 16:03:21 2015 +0000
@@ -225,7 +225,7 @@
 
     while(!m_done)
         __WFE();
-
+        
     return true;
 }
 
@@ -238,7 +238,8 @@
      */
     for(i=0; i<3; i++)
     {
-        sample = m_adc_aggregation[0] - m_adc_aggregation[i+1];
+        // Invert this because ADC signal inverted (no pull up)
+        sample = m_adc_aggregation[i+1] - m_adc_aggregation[0];
         rgb.data[i] = (sample<0) ? 0 : sample;
     }
 }