I have a custom PCB, powered by a LiPo battery.
It includes a voltage divider that cuts the battery voltage in half and delivers it to physical pin 8, which I think I can refer to as ADC_BATTERY.
(Am I wrong there? Is that the whole problem? ADC_BATTERY prints as "33". )
That pin, physical pin 8, reads 1.6 V (on my multimeter) from my mostly-drained 3.2V LiPo. All as expected.
But this sketch gives me a sensor value of 1023:
void setup() {
Serial1.begin(9600);
analogReference(AR_DEFAULT); // 3.3V I think
}
void loop() {
sensorValue = analogRead(ADC_BATTERY);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 4.3V):
float voltage = sensorValue * (4.3 / 1023.0);
Serial1.println(sensorValue);
Serial1.print(voltage); Serial1.println("V");
}
I would expect a much smaller sensor reading since the battery is pretty drained (on purpose).
I've tried changing analogreference() to various things - no joy.
Any advice welcome, and thank you all very much!

