   if (blue<=16) {Serial.print('0');}
   Serial.println(blue, HEX);
 }
+
+void setValue ( int r, int g, int b) {
+  red=r; green=g; blue=b;
+  setOutput(rgb);
+}
+

  if (input!="") { // if connected    
    switch (input[0]) {

      case 'd': { //enables debug mode, lowercase commands
        DEBUG=!DEBUG;
        Serial.print("Debug mode ");
        if (DEBUG) 
          Serial.println("ON");
         else 
          Serial.println("OFF");
        break;
      }
      

          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};
          
          decodeHex(hex1,col1p);
          decodeHex(hex2,col2p);
          float timeVal = atoi(timev); //use strtol or sscanf instead

          gradientPulse(col1,col2,timeVal);
          
          if (DEBUG) {
            Serial.println(hex1);
            Serial.println(hex2);
            Serial.println(timev); }
        }
        break;
      }

      // begin debugging char commands go here
      

    }

    if (DEBUG) {
      switch(input[0]) {
        case '0' : {
          setValue(0,0,0);
          Serial.println("LEDs turned off.");
          break; }
        case '1' : {
          setValue(255,255,0);
          Serial.println("LEDs turned on.");
          break; }
        case 'r' : {
          setValue(255,0,0);
          Serial.println("Color set to red.");
          break;
        }
        case 'g' : {
          setValue(0,255,0);
          Serial.println("Color set to green.");
          break;
        }
        case 'b' : {
          setValue(0,0,255);
          Serial.println("Color set to blue.");
          break;
        }
        case '?' : { // display contents of *rgb: three colors and a null pointer
          Serial.println("Current color values:");
          for (int i=0; i<3; i++) {
            Serial.print(*rgb[i]); Serial.print(',');
          }
          Serial.println(*rgb[3]);
        }
//        case 
        
      }


      
    }
  } else {
    // no input;
