You are reading a single comment by @indianajones and its replies. Click here to read the full conversation.
  • @Robin thanks for the reply, and @Gordon thanks for taking the time to help. RE: node event loop, it's not quite like the Arduino loop - I wasn't referring to Arduino's loop(), but rather how I believe the underlying Espruino code works. And even now I'm not sure that this clarification is helpful. Apologies for that.

    At any rate, what I hope the code will be able to accomplish is this:

    1) Read a pot's value every 10ms using setWatch
        a) Send that pot's value on Serial1 at the next serial message setInterval (every 10ms)
    2) Read a button press every 20ms using setWatch
        a) Send the button state on Serial1 at the next serial message setInterval (every 10ms)
        b) Enable/Disable the button's LED
    3) Receive a series of messages, totaling 100-ish bytes, on Serial1 from a sender, every 10ms
        a) if the message is present, move the pot's fader (motorized fader)
        b) if the message is present, send LED on/off commands to LED strip via SPI
        c) if the message is present, enable/disable that button's LED (from #2 above)
    

    That's the entire project. One setWatch(10ms), one setWatch(20ms), and one setInterval(10ms), each doing a small task or three and then getting out. With all that going on, my question was essentially "will the button's LED light immediately, when I press the button?", and "when I yank the fader back and forth, will the messages get sent with a real-time feel? Or will the messages stack up and have more of a burst-y feel?" I think I may have to write it all to find out, but any tips that helps minimize latency would be awesome.

About