   }    
 }
 
-
-
-
-void gradientPulseSetup (const int col1[3],const int col2[3], float timev) { // timev is now in seconds   
-  // in this initial version, gradient pulses are going to be locking.
-  // This is obviously a problem - add an interrupt when you have time.
-
-  gradDelayPerTick = (float) timev*1000/numdivs;
-  gradPercPerTick = (float) 1/numdivs;
-  if (debugMode) {
-    Serial.println("---gradientPulse---");
-    Serial.println("col1,col2:");
-    for (int i=0; i<3;i++) {
-      Serial.print(col1[i]);
-      Serial.print(' '); 
-    }
-    Serial.println();
-    for (int i=0; i<3;i++) {
-      Serial.print(col2[i]);
-      Serial.print(' '); 
-    }
-    Serial.print("gradDelayPerTick = ");
-    Serial.println(gradDelayPerTick);
-    Serial.print("gradPercPerTick = ");
-    Serial.println(gradPercPerTick);
-    Serial.println();
-  }
-  colorCopy(gradcol1,col1);
-  colorCopy(gradcol2,col2);
-  gradientThread.setInterval(gradDelayPerTick);
-  gradientThread.reset();
-  gradientThread.enable();
-}
-
-
-
-void gradientStep() {
-  if (gradPerc < 1.0) {
-    Serial.print(gradPerc);
-    Serial.println("/1");
-    gradientValue(gradcol1, gradcol2, gradPerc, rgb);
-    setOutput(rgb);
-    gradPerc+=gradPercPerTick;
-  }
-  else {
-    if (gradientLoop = true) {
-      gradPerc = 0;
-    } else {
-      gradientThread.disable();
-    }
-  }
-}
-
-void gradientValue(int col0[3], int col1[3], float percentage, int *output[3]) {
-  *output[0] = col1[0]*percentage + col0[0]*(1-percentage);
-  *output[1] = col1[1]*percentage + col0[1]*(1-percentage);
-  *output[2] = col1[2]*percentage + col0[2]*(1-percentage);
-}
-
 void printColors() {  
   Serial.print('#');
   if (red<=16) {Serial.print('0');}

  delay(baseTime);
  setValue(0,0,0);
}

  }
}

void processGradient() {
// run gradient pulse between a and b over a length of time; "G#000000:#123456:time" input
  if ((inputBuffer[1]!='#' || inputBuffer[9]!='#')) {
    Serial.println("Error: invalid gradient request");
    Serial.println(inputBuffer);
  } else {
    char hex1[8], hex2[8];
    char timev[8];
    for (int x = 0; x<7; x++) {
      hex1[x] = inputBuffer[1+x];
      hex2[x] = inputBuffer[9+x];
      timev[x] = inputBuffer[17+x];
    }
    int col1[4],col2[4];
    int *col1p[4] = {&col1[0],&col1[1],&col1[2],0};
    int *col2p[4] = {&col2[0],&col2[1],&col2[2],0};

    if (debugMode) {
      Serial.println("input char[]s");
      Serial.println(hex1);
      Serial.println(hex2);
      Serial.println(timev); }

    
    decodeHex(hex1,col1p);
    decodeHex(hex2,col2p);
    float timeVal = atol(timev); //use strtol or sscanf instead
    gradientPulseSetup(col1,col2,timeVal);

    if (debugMode) {
      Serial.println("col1: ");
      Serial.print(col1[0]); Serial.print(" "); Serial.print(col1[1]); Serial.print(" "); Serial.println(col1[2]);
      Serial.println("col2: ");
      Serial.print(col2[0]); Serial.print(" "); Serial.print(col2[1]); Serial.print(" "); Serial.println(col2[2]);
      Serial.print("timeVal: ");
      Serial.println(timeVal);
    }
  }
}


void timeoutAction() {
  
  if (debugMode) { Serial.println("Processing timeout."); }
  if (!recentActivity) {
    // maybe timeout and timeout behavior should be configurable over serial.
    // low priority, bc this will mostly be running before serial comms have
