something like this, I meant
digitalWrite(5, HIGH); // close the circuit, now A1 gets battery voltage
delay(500); // give relais some time
int measure_voltage = analogRead(A1); // now read the voltage
And...
voltage divider factor = 220/1220 = 0.18
Battery full: [b]9V[/b]
; 9V *0.18 = 1.62V
; 1.62V *1023/5V = 331
(=measure_voltage
)
Now map(0,331,0,1000)
(ca. multiply with 3, but there is an arduino function called map) and get 0.1% steps (promille) of battery voltage
int battery_voltage = map(measure_voltage,0,331,0,1000)
What do you think, good idea?