Just to add - yes, analogWrite uses the hardware by default, and the CPU isn't involved at all. Having said that, it uses the high speed oscillator, so it'll still end up using a bit of power (even if the CPU is totally free to do something else).
You can use {soft:true} to force software PWM though - it's occasionally useful if you want more PWM pins (for example on the LEDs), or if you can't get the combination of PWM frequencies you want.
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.
Just to add - yes,
analogWrite
uses the hardware by default, and the CPU isn't involved at all. Having said that, it uses the high speed oscillator, so it'll still end up using a bit of power (even if the CPU is totally free to do something else).You can use
{soft:true}
to force software PWM though - it's occasionally useful if you want more PWM pins (for example on the LEDs), or if you can't get the combination of PWM frequencies you want.