Was checking power consumption to use the CR2032 battery sensibly. Used meter with mA scale with two fractional digits (have better one but couldn't find right cables :-).
default advertising of 375 ms gives value between 0.02-0.04mA, when changing to 750 it drops to .01-0.00mA
default connection interval (7.5ms) when connected gives about 0.6mA, when changing to 50 it drops below 0.1mA and is still good enough for interactive console
LED is over 1mA (1.7? forgot exactly), analogWrite drops it down and it is still visible
Piezo (tested with board that parasquid posted in post #5)
when set to 0 (D14.reset()) it draws 32mA (!!) don't do that!
sound done via analogWrite(0.5,{freq:440}) eats half of that - 16mA(!!) don't do that!
analogWrite(0.97,{freq:440}) draws fraction of that (below 1mA?) and I don't hear any difference in loudness (analogWrite(0.03,{freq:440}) of course draws fraction below 32mA and sounds the same)
Did the measurements because I noticed E.getAnalogVref() gives voltage below 2.5V for the tag where I tested the piezo while other gave me 3.0V. So looks like I have basically killed the battery when trying to play sounds :-)
Ah! No wonder I thought the battery went flat so fast. Thanks for the piezo hint (I tried playing a beep when the button was pressed but I reset the pin after the button is depressed).
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.
Was checking power consumption to use the CR2032 battery sensibly. Used meter with mA scale with two fractional digits (have better one but couldn't find right cables :-).
LED is over 1mA (1.7? forgot exactly), analogWrite drops it down and it is still visible
Piezo (tested with board that parasquid posted in post #5)
D14.reset()
) it draws 32mA (!!) don't do that!analogWrite(0.5,{freq:440})
eats half of that - 16mA(!!) don't do that!analogWrite(0.97,{freq:440})
draws fraction of that (below 1mA?) and I don't hear any difference in loudness (analogWrite(0.03,{freq:440})
of course draws fraction below 32mA and sounds the same)Did the measurements because I noticed E.getAnalogVref() gives voltage below 2.5V for the tag where I tested the piezo while other gave me 3.0V. So looks like I have basically killed the battery when trying to play sounds :-)