 
 void loop() {
   current_time = millis ();
-  if (current_time - previous_time >= SENSE_INTERVAL) {
-    previous_time = current_time;
+  
+  if (cmd_end == true) {
+    switch cmd[0] {
+      case 'R':
+        if (isDigit (cmd[1]) {
+          // inversion LED rouge
+          unsigned byte state = atoi(cmd[1];
+          if ((state == LOW) || (state == HIGH)) {
+            red_state = state;
+            digitalWrite (red_led, red_state);
+          }
+        }
+        break;
+      case 'B':
+        if (isDigit (cmd[1]) {
+          // inversion LED bleue
+          unsigned byte state = atoi(cmd[1];
+          if ((state == LOW) || (state == HIGH)) {
+            blue_state = state;
+            digitalWrite (blue_led, blue_state);
+          }
+        }
+        break;
+      default:
+        break;
+    }
+    cmd_end = false;
+  }
+  
+  if (current_time - prev_temp_time >= TEMP_INTERVAL) {
+    prev_temp_time = current_time;
     
     // lecture capteur temperature (2 fois pour pb impédance ?)
     analogRead (temp_pin);

  return (pot_value);
}

void setup() {
  // lancement port série
  Serial.begin (9600);

    voltage = (sensor_value / 1024.0) * 5.0;
    temp_value = (voltage - 0.5) * 100;
    
    Serial.print ("t:");
    Serial.println (temp_value);
  }
  
  if (current_time - pot_temp_time >= POT_INTERVAL) {
    pot_temp_time = current_time;
    
    blue_pot_value = analyse_pot (blue_pot, blue_pot_led);
    green_pot_value = analyse_pot (green_pot, green_pot_led);
    
    // écriture mesures port série
    Serial.print ("p:");
    Serial.print (green_pot_value);
    Serial.print ("-");
    Serial.println (blue_pot_value);
  }
  
  if (current_time - yellow_temp_time >= YELLOW_INTERVAL) {
    yellow_temp_time = current_time;
    
    // scintillement jaune
    yellow_state = !yellow_state;
