Use Adafruit Colorsensor to distinguish between green and red
Based on what I could find, you will have to calibrate the sensor to recognize these colours. First, run the Colourview code. Take down the raw RGB and CLEAR values obtained for an object you consider green and another you consider red. Find out if these values are consistent, each time you power down the sensor and turn it on again. If they aren't, record how much dead zone there is i.e. the maximum difference in readings (between resets) that you get for the same colour. Then using the values you get, try this code:

#include &lt;Wire.h&gt;
#include "Adafruit_TCS34725.h"

#define MAX_OFFSET 50  // the maximum diff you found between readings

typedef struct {  // struct to hold raw color data 
   uint16_t red;
   uint16_t green;
   uint16_t blue;
   uint16_t clear;
} Color;

Color my_red = {3344, 3333, 23444, 3333}; //here you enter your minimum recorded values for red in the order of the struct members above
Color my_green = {22222, 4444, 5555, 3333}; //the same for green

void setup() {
  Serial.begin(9600);
  Serial.println("Color View Test!");

  if (tcs.begin()) {
    Serial.println("Found sensor");
  } else {
    Serial.println("No TCS34725 found ... check your connections");
    while (1); // halt!
  }
}

void loop() {
  uint16_t clear, red, green, blue;

  tcs.setInterrupt(false);      // turn on LED

  delay(60);  // takes 50ms to read 

  tcs.getRawData(&amp;red, &amp;green, &amp;blue, &amp;clear);

  tcs.setInterrupt(true);  // turn off LED
  if (compare_colour(&amp;my_red, red, green, blue, clear)){
      Serial.println("I see red.");
  }
  else if (compare_colour(&amp;my_green, red, green, blue, clear)){
      Serial.println("I see green.");
  }
}

boolean compare_color(Color * std, uint16_t r, uint16_t g, uint16_t b, uint16_c){
if ((r - std.red &lt;= MAX_OFFSET) &amp;&amp; (r - std.red &gt;= 0) &amp;&amp;
      (g - std.green &lt;= MAX_OFFSET) &amp;&amp; (g - std.green &gt;= 0) &amp;&amp;
      (b - std.blue &lt;= MAX_OFFSET) &amp;&amp; (b - std.blue &gt;= 0) &amp;&amp;
      (c - std.clear &lt;= MAX_OFFSET) &amp;&amp; (c - std.clear &gt;= 0))
  {
      return true;
  }
  return false;
}


You can use this code directly after you have gotten the sensor readings for red and green objects.