In order to read the battery voltage you need to connect the + of the battery to a resistor to and to the A0 pin on your microcontroller. The resistor is so that you don’t damage the A0 pin and the microcontroller that can only take 1 volt.
Okay, thank you very much, someone also told me to put a voltage divider with three resistors on one side and one on the other to have a quarter of the battery voltage. What I want to know also is how to calculate the battery percentage, I’m going to look it up.