How to use threads in a sketch?

Callback serialEvent() is already invoked by Serial’s thread:
Processing.org/reference/libraries/serial/serialEvent_.html

So it can act as a “producer” thread like in this example:

1 Like