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.