int valor = 0; int total = 0; int media = 0; int posicion; int i=0; void setup() { Serial.begin(9600); } void loop() { total = 0; for(i=0; i <= 9; i++){ valor = analogRead(A0); // Leemos del pin A0 valor total = total + valor; } media = total / i; // Imprimimos el valor medio por el monitor serie (0 - 1023) posicion = map(media, 0, 1023, 0, 100); // convertir a porcentaje Serial.println(posicion); }