#include <Servo.h>
Servo myservo;
int pos = 0; int port = A0; int valeur = 0; float vin = 0; float imax = 0; void setup() {
Serial.begin(9600); myservo.attach(9);
}
void loop()
{ valeur = analogRead(port);
vin = (valeur * 5.0) / 1024.0; delay(1000);
for(pos = 0; pos <= 180; pos += 1) { myservo.write(pos); if (vin > imax) { imax = vin; } delay (1000);
}
Serial.println(imax);
}