Thanks everyone for their thoughtful and helpful replies. I will need to explore the draw() loop more because I suspect I don’t understand it fully, and here’s why: I do understand a straightforward main event loop and use it extensively for event dispatching on Arduino. There seem to be two confounding issues for me. First, if one chooses to use it, there’s a second potential event loop based on serial events. This is invoked by putting a call to mySerialPort.buffer() or mySerialPort.bufferUntil() in setup() and then constructing an appropriate SerialEvent() function. This has proven to be quite useful for me in other parts of the program, and I’m reluctant to part with it.
The second, perhaps less esoteric issue is that I’m using Quark’s G4P library for a GUI. The control items that can receive user input (generally typing or mousing) handle actions with listener functions. I suspect I don’t fully understand how a listener function is triggered with respect to the draw() loop. More research and reading needed, I guess.
Again, thank you all.
1 Like