 
   // startup animation
   rainbow(2);
-  colorWipe(strip.Color(MAX_VAL, MAX_VAL, MAX_VAL), DELAY_TIME); // White
-  colorWipe(0, DELAY_TIME); 
+  colorWipe(0, DELAY_TIME);
 }
+
+//void loop() {
+//    if (0<Serial.available()) {
+//      // 255,255,255 255,255,255
+//      String str = Serial.readStringUntil('\n');
+//      int inst_r = str.substring(0,3).toInt();
+//      int inst_g = str.substring(4,7).toInt();
+//      int inst_b = str.substring(8,11).toInt();
+//  
+//      // あまり強く光らせると色が安定しないのでリミットを設ける
+//      int _inst_r = constrainValue(inst_r);
+//      int _inst_g = constrainValue(inst_g);
+//      int _inst_b = constrainValue(inst_b);
+//      Serial.println("::: setColor :::");
+//      Serial.println("instrument:["+String(inst_r)+","+String(inst_g)+","+String(inst_b)+"] constrains to ["+String(_inst_r)+","+String(_inst_g)+","+String(_inst_b)+"]");
+//      
+//      instrument_color = strip.Color(_inst_r, _inst_g, _inst_b);
+//      updateLED();
+//    }
+//}
 
 void loop() {
   if (0<Serial.available()) {
-    // 255,255,255 255,255,255
-    String str = Serial.readStringUntil('\n');
-    int inst_r = str.substring(0,3).toInt();
-    int inst_g = str.substring(4,7).toInt();
-    int inst_b = str.substring(8,11).toInt();
-
-    int effect_r = str.substring(0,3).toInt();
-    int effect_g = str.substring(4,7).toInt();
-    int effect_b = str.substring(8,11).toInt();
-
-    // あまり強く光らせると色が安定しないのでリミットを設ける
-    int _inst_r = constrainValue(inst_r);
-    int _inst_g = constrainValue(inst_g);
-    int _inst_b = constrainValue(inst_b);
-    int _effect_r = constrainValue(effect_r);
-    int _effect_g = constrainValue(effect_g);
-    int _effect_b = constrainValue(effect_b);
-    Serial.println("::: setColor :::");
-    Serial.println("instrument:["+String(inst_r)+","+String(inst_g)+","+String(inst_b)+"] constrains to ["+String(_inst_r)+","+String(_inst_g)+","+String(_inst_b)+"]");
-    Serial.println("effect:["+String(effect_r)+","+String(effect_g)+","+String(effect_b)+"] constrains to ["+String(_effect_r)+","+String(_effect_g)+","+String(_effect_b)+"]");
-    
-    updateColor(strip.Color(_inst_r, _inst_g, _inst_b), strip.Color(_effect_r, _effect_g, _effect_b));
+    String command = Serial.readStringUntil(':');
+    String argument = Serial.readStringUntil(';');
+    if(command=="0") {
+      Serial.println(command);
+      if(argument.length()==11) {
+        // argument likes "255.255.255"
+        int r = constrainValue(argument.substring(0,3).toInt());
+        int g = constrainValue(argument.substring(4,7).toInt());
+        int b = constrainValue(argument.substring(8,11).toInt());
+        instrument_color = strip.Color(r, g, b);
+        updateLED();
+      }
+      else {
+        Serial.print("Invalid argument:");
+        Serial.println(argument);
+      }
+    }
+    else if(command=="1") {
+      if(argument.length()==11) {
+        // argument likes "255.255.255"
+        int r = constrainValue(argument.substring(0,3).toInt());
+        int g = constrainValue(argument.substring(4,7).toInt());
+        int b = constrainValue(argument.substring(8,11).toInt());
+        effect_color = strip.Color(r, g, b);
+        updateLED();
+      }
+      else {
+        Serial.print("Invalid argument:");
+        Serial.println(argument);
+      }
+    }
+    else {
+      Serial.print("Command not found:");
+      Serial.println(command);
+    }
   }
 }
 

String input_str;   // 文字列格納用
int i = 0;  // 文字数のカウンタ

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'

}
 
// Slightly different, this makes the rainbow equally distributed throughout
//void rainbowCycle(uint8_t wait) {
//  uint16_t i, j;
// 
//  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
//    for(i=0; i< strip.numPixels(); i++) {
//      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
//    }
//    strip.show();
//    delay(wait);
//  }
//}
 
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
