What runs when? A quick explainer on execution order in Arduino + Stepdance
This is how the basic Arduino logic works:

This is very similar conceptually to how the draw loop in P5 or Processing works. Imagine that the main program:
- calls
setup()as soon as it starts - has a huge
whileloop that continuously callsloop().
In the first example (step-a-sketch), we were continuously updating the X and Y by mapping the encoder values:
So the mapping is executing the whole time behind the scenes (from the Stepdance library).
The position generator (seen last class) enables us to launch execution of a motion at a discrete point in time:
Note that it then runs for a little while (your plotter does not instantly teleport to that position).
If we run a second position generator command at the same time, the executions will overlap!

The time-based interpolator works differently, where moves are queued:
