tweaked detection to use photoresistor through an opamp

Dependents:   rgb_sensor_buffer

Fork of rgb_sensor by Milosch Meriac

Files at this revision

API Documentation at this revision

Comitter:
bridadan
Date:
Fri Mar 20 16:03:21 2015 +0000
Parent:
9:7bd80f4a965e
Commit message:
Tweaked sensor because photoresistor using inverted voltage (ran through an opamp)

Changed in this revision

rgb_sensor.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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;
     }
 }