can anyone help me with displaying the voltage to the hundredths place in the serial monitor?
so far i have this but it outputs 12.60 volts when the true voltage is 12.85
827-829 on the analogRead = 12.85v
int vPin = 5;
int val = 0;
void setup(){
Serial.begin(9600);
pinMode(vPin, INPUT);
}
void loop(){
val = analogRead(vPin);
Serial.print(val / (645/10), DEC);
Serial.print(".");
Serial.println(val % (645/10) ,DEC);
delay(1000);
}
any help?