Slow Serial Port connection with processing

is the idea I want to start from, for example.

Why? Sending a value ONCE when crossing into, or out of, the box makes sense. Continually spamming "I'm in the box" or "I'm out of the box" does not.

Anyway, the point is to define whether the serial data transfer is really slow, or if the spamming is the problem.