 #define blueLED 4 //acknowledgement & blue led port
 #define thErrON 0.9 //threshold multipler HIGH leds
 #define thErrOFF 1.5 //threshold multipler LOW leds
-#define setupWaitTime 0 //(ms) delay at setup time 
+#define setupWaitTime 1 //(ms) delay at setup time 
 #define fbTime 250 //(ms) feedback led on time
 #define cycTime 250 //(ms) feedback led off time
 #define sync "MODE_sync" // keyword for start sync seq (transmitter side)

  } 
  delay(setupWaitTime);
  //set threshold for green high
  th_Val[2].r_t = ((float) r * thErrOFF); 
  th_Val[2].g_t = ((float) g * thErrON);
  th_Val[2].b_t = ((float) b * thErrOFF);
  while(g > th_Val[0].g_t) //wait until green is LOW
  {
    tcs.getRawData(&r, &g, &b, &c); 

  }
  delay(setupWaitTime); 
  //set threshold for red-green high
   r_h = g_h = b_h = 0;
  while(true)
  {
    tcs.getRawData(&r, &g, &b, &c); //get env info
    if(r > r_h)
    {
      r_h = r;
      if(b_h < b)
      {
        b_h = b;
      }
    }
    else if(g > g_h)
    {
      g_h = g;
      if(b_h < b)
      {
        b_h = b;
      }
    }
    else
    {
      th_Val[4].r_t = ((float) r_h * thErrON); 
      th_Val[4].g_t = ((float) g_h * thErrON);
      th_Val[4].b_t = ((float) b_h * thErrOFF);
      break;
    }
  }
  while((r > th_Val[0].r_t) | (g > th_Val[0].g_t)) //wait until red and green is LOW
  {
    tcs.getRawData(&r, &g, &b, &c); 
