I have tried for a while now, and i just understand how i can smooth out the voltage readings. I have tried different codes with no luck.
Here is an screenshot of readings:
And here is a code i found on Youtube. What am i doing wrong here?
int voltPin = A0;
void setup() {
Serial.begin(9600);
pinMode(voltPin, INPUT);
}
void loop() {
int numReads = 100;
int senseSum = 0;
for (int k = 0; k < numReads; k++) {
senseSum += analogRead(voltPin);
}
int senseAve = senseSum / numReads;
float voltage = senseAve * (17.0 / 1023.0);
Serial.print("Battery Voltage: ");
Serial.print(voltage);
Serial.println("V");
delay(2000);
}
