I got this color sensor last week, I've been able to get the sensor to recognize blue and red, but not green. still working on this. I use the code in the product page.
so anybody have any idea about this issue? Pretty thanks.
I got this color sensor last week, I've been able to get the sensor to recognize blue and red, but not green. still working on this. I use the code in the product page.
so anybody have any idea about this issue? Pretty thanks.
Check that you've connected all the Arduino pins correctly to the sensor. In particular, make sure pin 4 on the Arduino is connected to S2 on the sensor.
It's the combination of signals on S2 and S3 which determines which colour is being detected:
S2 S3 Colour
---- ---- ------
Low Low Red
Low High Blue
High Low Clear
High High Green
If S2 is always low then you can only detect red and blue.
If the connections are definitely correct, then ensure you haven't made any code modifications which could interfere with it. You may also want to test pin 4 on your Arduino (e.g. using a multimeter) to make sure it's working properly. If necessary, you could use a different pin instead. However, you'll need to modify the #define S2
line in the code to match.
Clear
means there's no filter, so it will simply detect the brightness of all visible light falling on it. If you apply the red filter, it mainly detects the brightness of red light, and so on. To detect the actual colour of something, you have to take three readings to get the RGB components; i.e. one with each filter applied.
– Peter Bloomfield
Dec 15 '14 at 9:51