digitalPulse, pwm or setInterval for flashing/beeping? #5905
Unanswered
espruino-discuss3
asked this question in
General
Replies: 1 comment
-
Posted at 2018-04-06 by @gfwilliams It depends a little on your board what's better but basically:
Honestly, However nothing would stop you from writing a little utility function that used |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-04-05 by MikeD
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!
Beta Was this translation helpful? Give feedback.
All reactions