 #define MIN_BTM_ANGLE 30 // Minimum bottom servo angle
 #define NUM_OF_CUPS 5 // The number of cups at the bottom
 #define EACH_CUP_ANGLE_INTERVAL ((MAX_BTM_ANGLE - MIN_BTM_ANGLE) / NUM_OF_CUPS)
-  int btmAngle = MIN_BTM_ANGLE + EACH_CUP_ANGLE_INTERVAL * sortingResult;
+  int btmAngle = MIN_BTM_ANGLE + EACH_CUP_ANGLE_INTERVAL * 
+    (sortingResult == -1? int(NUM_OF_CUPS/2): sortingResult);
   servoBtm.write(btmAngle);
 }
 

    Serial.println("Average color:");
    avg_c.print();
  }


}

void updateColorSensor() {

#define PIN_LCD_D7 2
//    LCD R/W pin to ground

// Uncomment the following line to enter calibration mode
// #define F_CALIBRATING true // Is calibration in progress

// Constants
#define C_ATIME TCS34725_INTEGRATIONTIME_154MS //  Color sensor integration time 154ms
