I think analogRead(D3) might have been a hack for the Bangle.js? On the Puck D3 is connected to the Blue LED - so probably not what you want!
NRF.getBattery() won't work well because it's expecting voltages from a Lithium battery, not a LiFePo4 :)
So what you need is E.getAnalogVRef() which will give you the actual voltage on the chip - probably just one call to that might work, but you could do like above, calling it 10 times and then dividing by 10.
The voltage there should correspond pretty well to what you get if you google "lifepo4 discharge curve"
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I think
analogRead(D3)
might have been a hack for the Bangle.js? On the Puck D3 is connected to the Blue LED - so probably not what you want!NRF.getBattery()
won't work well because it's expecting voltages from a Lithium battery, not a LiFePo4 :)So what you need is
E.getAnalogVRef()
which will give you the actual voltage on the chip - probably just one call to that might work, but you could do like above, calling it 10 times and then dividing by 10.The voltage there should correspond pretty well to what you get if you google "lifepo4 discharge curve"