   return (pot_value);
 }
 
+void serialEvent () {
+  while (Serial.available ()) {
+    char recv = (char)Serial.read ();
+    if (recv == '\n') {
+      cmd_end = true;
+      index_cmd = 0;
+    } else {
+      if (index_cmd <= 1) {
+        cdm[index_cmd] = recv;
+        index_cmd++;
+      }
+    }
+  }
+}
+
 void setup() {
   // lancement port série
   Serial.begin (9600);

    voltage = (sensor_value / 1024.0) * 5.0;
    temp_value = (voltage - 0.5) * 100;
    
    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 (temp_value);
    Serial.print ("-");
    Serial.print (green_pot_value);
    Serial.print ("-");
    Serial.println (blue_pot_value);
    
    // scintillement jaune
    yellow_state = !yellow_state;

#define BOUNCE_DELAY 250
volatile unsigned long last_toogle_time = 0;

// pour lecture commande sur port série
char cmd [2];
bool cmd_end = false;

// pour gestion delai entre 2 acqusitions
#define TEMP_INTERVAL 10000
#define POT_INTERVAL  3000
#define YELLOW_INTERVAL 1000

unsigned long prev_temp_time = 0;
unsigned long prev_pot_time = 0;
unsigned long prev_yellow_time = 0;
unsigned long current_time = 0;

// variables utilisées dans setup et/ou loop
