float Leitura(int analogInPin)
{
float sensorValue = 0;
float outputValue = 0;
float ReadValue = 0;
int ReadTimes = 0;
for (int i =0; i < 10; i++)
{
ReadValue = analogRead(analogInPin);
Serial.println(ReadValue);
if (ReadValue > 0)
{
sensorValue = sensorValue + ReadValue;
ReadTimes++;
delay(2);
}
}
outputValue = sensorValue / ReadTimes;
return outputValue;
}