It will not help to measure the battery voltage, it is too steady and does not indicate how much juice is left. you need to measure the discharge current and integrate. Search for "Coulomb counter". There are ICs that are made for this purpose. Another search term is "battery fuel gauge" and "battery state-of-charge". I think there is a breakout board for LTC4150, for example.
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.
It will not help to measure the battery voltage, it is too steady and does not indicate how much juice is left. you need to measure the discharge current and integrate. Search for "Coulomb counter". There are ICs that are made for this purpose. Another search term is "battery fuel gauge" and "battery state-of-charge". I think there is a breakout board for LTC4150, for example.