             i=-1; 
          }
       }
+  
   }
   
-  
-    //if (Serial.read()==65) {
-      //servo[2].write(180);
-      //Serial.println("caca");
-      //angle[i%nbrServos] = Serial.read();
-      //if (angle[nbrServos-1]>0) {   
-        /*for (int k=0; k<nbrServos ; k++) {
-          Serial.print("Servo numero ");
-          Serial.println(k+1);
-          Serial.println(angle[k]);
-          servo[k].write(angle[k]);
-          angle[k]=0;
-        }
-        delay(3);
-      }*/
-    //}
-    //i++;
- //}
+  periode++;
  }
+ 
+ 
+void voltmetre(){
+    mesure_voltage = analogRead(0);
+    voltage = mesure_voltage / (255/5);
+    voltage = voltage * 0.50229;
+    batteryLevel=(voltage-6.6)*100/2.4;
+    if(batteryLevel > 0) Serial.println(batteryLevel);
+    //Serial.print(voltage);
+    //Serial.println(" V ");
+    //else Serial.println("error");
+}
+ 
+ 
+void glowingLED(int periodeLED){
+ for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { 
+    analogWrite(pinLED, fadeValue);         
+    // wait for periodeLED milliseconds to see the dimming effect    
+    delay(periodeLED);                            
+  } 
+
+  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { 
+    analogWrite(pinLED, fadeValue);         
+    // wait for periodeLED milliseconds to see the dimming effect    
+    delay(periodeLED);                            
+  } 
+}
+ 
+void flashingLED(int periodeLED){
+  analogWrite(pinLED,250);
+  delay(periodeLED);
+  analogWrite(pinLED,0);
+  delay(periodeLED);
+}
+ 
+void stillLED(){
+  analogWrite(pinLED,250);
+}

         Serial.println(" ");
         i=0; 
      }
      else {
         //Serial.print(c);
         //Serial.print(" ");
         if(i>=0 && i<nbrServos) {
            angle[i]=c;
            //Serial.print("Servo numero ");
            Serial.print(i+1);

}

void loop() {
  if (periode>16000000){
    voltmetre();
    periode=0;
    //Serial.println("loop");
  }
  
  while (Serial.available()){

      int c=Serial.read();
