Heltec battery power example not working

Hello,

I used this example to read the battery status of my Lora V2:

But it reads always ~3100mV:
With only USB connected
With no USB and a full LiPo
With no USB and an nearly empty LiPo
With USB and a full/empty LiPo

What am I doing wrong?

image
It should be 37.

Yes, I saw that and I had already changed that to adcAttachPin(37).
Same results. Always 3000 to 3100mv.
Any other suggestions?

I don’t know when you bought the node. If you are an old node, then the pins should be 13 pins.

it was a new device and it apparently was pin 37.
But the example is wrong. The culprit is this line:
float XS = 0.00225;
The multiplier is not correct.
In this thread user “wombat” wrotes about a 320K/100K voltage divider:

But 320/100=3.2
So if I use
float batteryVoltage=3.2*analogRead(37);
it seems that I get correct values:
Around 4.1V with USB connected, 3.8V with LiPo connected.