tweaked detection to use photoresistor through an opamp
Fork of rgb_sensor by
Diff: rgb_sensor.cpp
- Revision:
- 9:7bd80f4a965e
- Parent:
- 8:88acb970df76
- Child:
- 10:b95dfd2d6d4d
- Child:
- 11:fea393d0d17a
--- a/rgb_sensor.cpp Thu Jul 03 16:52:12 2014 +0000 +++ b/rgb_sensor.cpp Thu Jul 03 17:24:41 2014 +0000 @@ -145,10 +145,12 @@ if(!m_done) { /* filter value to remove ADC noise/conversion errors */ - m_adc_aggregation[m_rgb_channel] += filter(sample); + sample = filter(sample); + if(m_adc_count>=RGB_SENSOR_IGNORE) + m_adc_aggregation[m_rgb_channel] += sample; m_adc_count++; - if(m_adc_count>=RGB_OVERSAMPLING) + if(m_adc_count>=(RGB_OVERSAMPLING+RGB_SENSOR_IGNORE)) { m_adc_count=0; m_rgb_channel++;