Hello guys. I am having a problem. I want to monitorize the charge of my battery while it's being used. The problem is that it's a 9 volt battery and i don't know if i am adressing the problem correctly.
The code i am using is this one:
float lectura;
float volt;
void setup() {
Serial.begin(9600);
pinMode(A0,INPUT);
}
void loop() {
lectura = analogRead(A0);
volt = lectura /1023 * 5.0;
Serial.println(volt);
}
the conections are like this:
in case u cant see the image the link to the conections