mousePressed not updating in while loop

i am a little bit confused by your question,
because this is not your first processing program,
as you do already arduino, processing, serial communication…

your idea goes so much against any processing thinking
( but also arduino or any PLC like programming )

now in draw:
you draw ( design ) something, but
processing loop execution is like:

  • read mouse, keyboard, ( file lines… ) in a input cycle
  • run code from draw ( and use the input information )
  • do all outputs like
    • send drawing as resulting picture to graphic card output
    • write to files…

and unless you disable it all this is executed 30 times per second
( default frameRate )
IN -> CALC -> OUT .

now for that reason pls

– not use delay in draw
– break while loops by logic ( or not use at all )
( as keyboard and mouse only can be read before draw / while )

1 Like