You are reading a single comment by @indianajones and its replies.
Click here to read the full conversation.
-
Tue 2019.07.23
'(i.e. will my code get called at unpredictable intervals. . .'
Hi @indianajones, with the concept presented, it's more likely that setInterval() will be of concern.
Excellent article:
How JavaScript Timers Work
I'm working on a project idea for the Pico that will have a slide potentiometer and a couple buttons. I intended to use setWatch to watch for the pins that are connected to the pot and buttons, but I'm wondering how responsive my code will be, especially regarding the pot. I plan on setting the watches for 10ms, but I don't know if having 3 separate 10ms watches on 3 input pins will create unpredictable latency (i.e. will my code get called at unpredictable intervals, ruining the real-time feel to the user).
And of course, the code will be acting on these timers, sending data out a USART, receiving commands on that USART...so quite a bit going on. I'm also wondering if all that other activity could impact the determinism of the watches.
Any thoughts on that? Suggestions for improvement?