     Serial.print(gradPerc);
     Serial.println("/1");
     gradientValue(gradcol1, gradcol2, gradPerc, rgb);
-    setOutput(rgb);
+    outputColor(rgb);
     gradPerc+=gradPercPerTick;
   }
   else {
     if (gradientLoop) {
       gradPerc = 0;
+      if (gradientMode) {
+        int temp[3]; //swap 1 and 2
+        arrayCopy(temp,gradcol1,3);
+        arrayCopy(gradcol1,gradcol2,3);
+        arrayCopy(gradcol2,temp,3);
+      }
       if (debugMode) { Serial.println("Looping gradient."); }
     } else {
       if (debugMode) { Serial.println("Halting gradient."); }

      case 'V': { processColor(); break; } // set value specified in V#FFFFFF input
      case 'L' : { gradientLoop = true; processGradient(); break;}
      case 'G' : { gradientLoop = false; processGradient(); break;}
    }
    if (debugMode) {
      processDebug();
    }
    clearBuffer();
  } else if (debugMode) { Serial.println("No serial input."); }
}

void toggleDebug() {
  debugMode = !debugMode;
  Serial.print("Debug mode ");
  if(debugMode) {
    Serial.println("ON" );  }
  else {
    Serial.println("OFF");  }
}

void processDebug() {
      switch(inputBuffer[0]) {
        case '0' : {
          setValue(0,0,0);

    pinMode(GND,OUTPUT);
  }
  gradientThread.disable();
  flashThread.disable();
  Serial.setTimeout(SERIAL_CYCLE_LENGTH/7); //should be substantially less than serialThread's execution window
  Serial.begin(BAUDRATE);
  quickCycle(25); // power-up notification
}
