detect the color of a traffic light with the tcs34725

Hello,

For a school work we have to make a robot-car that can read traffic lights,
The distance between the sensor and the traffic light is 15 cm,
but we are struggling to write a good arduino program to detect the color of the traffic light.
We need to detect the difference between a red light and are green light.
The lights are flickering with a frequency of 1 hertz.

Can somebody help?

Have you tried adafruit's tutorial?

Yea,

I already read the tutorial and pdf but none of them gave me enough information to work it out on my own.

Take eight readings over a two second interval. If all are the same color then that's the color. If the first part is one color and the last part is the other color then the light changed in the middle and the new color is the last part.