I've got an MDBT42Q connected to a LiPo battery. Is there any way to calculate the percentage of the battery that's remaining? The build-in function only works for Puck, Pixl and Bangle.
Can I do something similar to what they have?
JsVarInt jswrap_puck_getBattery() {
JsVarFloat v = jshReadVRef();
int pc = (v-2.2)*100/0.6;
if (pc>100) pc=100;
if (pc<0) pc=0;
return pc;
}
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've got an MDBT42Q connected to a LiPo battery. Is there any way to calculate the percentage of the battery that's remaining? The build-in function only works for Puck, Pixl and Bangle.
Can I do something similar to what they have?
Thanks.