   // printColors(r, g, b, c);
 
 
+}
+
+void updateColorView() {
+  static int oldSortingResult = -1;
+  if (sortingResult != oldSortingResult) {
+    oldSortingResult = sortingResult;
+    switch (sortingResult) {
+      case 0:
+        Serial.println("RED");
+        analogWrite(PIN_COLOR_RED, 255);
+        analogWrite(PIN_COLOR_GREEN, 0);
+        analogWrite(PIN_COLOR_BLUE, 0);
+        break;
+      case 1:
+        Serial.println("GREEN");
+        analogWrite(PIN_COLOR_RED, 0);
+        analogWrite(PIN_COLOR_GREEN, 255);
+        analogWrite(PIN_COLOR_BLUE, 0);
+        break;
+      case 2:
+        Serial.println("YELLOW");
+        analogWrite(PIN_COLOR_RED, 255);
+        analogWrite(PIN_COLOR_GREEN, 255);
+        analogWrite(PIN_COLOR_BLUE, 0);
+        break;
+      case 3:
+        Serial.println("PURPLE");
+        analogWrite(PIN_COLOR_RED, 128);
+        analogWrite(PIN_COLOR_GREEN, 32);
+        analogWrite(PIN_COLOR_BLUE, 128);
+        break;
+      case 4:
+        Serial.println("ORANGE");
+        analogWrite(PIN_COLOR_RED, 255);
+        analogWrite(PIN_COLOR_GREEN, 128);
+        analogWrite(PIN_COLOR_BLUE, 32);
+        break;
+      default:
+        Serial.println("Unknown color");
+        analogWrite(PIN_COLOR_RED, 0);
+        analogWrite(PIN_COLOR_GREEN, 0);
+        analogWrite(PIN_COLOR_BLUE, 0);
+        break;
+    }
+  } else {
+    // Check if the color view signal has lasted enough time
+    if (millis() - lastSkittleTime > C_COLOR_SIGNAL_TIME) {
+      // Set it back to black
+      analogWrite(PIN_COLOR_RED, 0);
+      analogWrite(PIN_COLOR_GREEN, 0);
+      analogWrite(PIN_COLOR_BLUE, 0);
+    }
+  }
 }
 
 void loop() {

// Create the color sensor object
Adafruit_TCS34725 tcs = Adafruit_TCS34725(C_ATIME, TCS34725_GAIN_1X);

// The number of skittles sorted
int skittleCount = 0;
// Time when the last skittle was being sorted
unsigned long lastSkittleTime = 0;

void setup() {
  // Set up the serial for debugging purposes

    lastSkittleTime = millis();
  }

  if (F_TOP_SERVO_TIMEOUT_ENABLED && reverseDirection && millis() - lastSkittleTime > 1000) {
    // Set direction back to normal after 1s
    reverseDirection = false;
  }

