Hi, I tried the code pasted above but didn't work for me.
I started measuring differents batteries, and I founded that analogRead(ADC_BATTERY) instruction give directly the voltage *100, I don't know the reason.
Due the measurement error (arduino or multimeter), I made an average and my correction factor is 103.06.
You don't need to change the analog resolution or the analog reference, all these values are by default.
I paste my code
in void loop
// read the battery:
int battread = analogRead(ADC_BATTERY);
// convert to a voltage:
float voltbatt = (battread / 103.06);