I have a project where I'd like to pulse a buzzer. right now i'm using setInterval as I read that digitalPulse should only be used for short durations (in the microseconds). I also recently realized that pwm can be used for this purpose.
the one thing i dont like about setInterval is that it makes the code harder to read with various nested intervals if I want to have different buzz patterns. why does it say digitalpulse should only be used for short intervals? is there some problem if I want to have it on for a second? or a half second?
which of these will yield best power utilization as well? it's not super-critical but if one is 10x more power than another, i'll do the power efficient one.
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 have a project where I'd like to pulse a buzzer. right now i'm using setInterval as I read that digitalPulse should only be used for short durations (in the microseconds). I also recently realized that pwm can be used for this purpose.
the one thing i dont like about setInterval is that it makes the code harder to read with various nested intervals if I want to have different buzz patterns. why does it say digitalpulse should only be used for short intervals? is there some problem if I want to have it on for a second? or a half second?
which of these will yield best power utilization as well? it's not super-critical but if one is 10x more power than another, i'll do the power efficient one.
thanks!