PaulS:
Unlike loop() on the Arduino, draw() is not called as fast as possible. There is a frame rate that determines when the next call to draw() happens.I don't think that the problem involves the amount of data being sent. Rather, it involves how often data is sent.
Look at the Processing documentation for frame rate. Or, create a while loop in draw() to send more data per invocation of draw().
Thank you both, but the problem isn't the low frameRate.
In fact, I can esclude the "draw" and do
void setup()
{
..
while (true) myPort.write((byte) (int)random(16));
}
But I can say that it surely doesn't go over 3-4 fps.
EDIT: Tried with this
while (true)
{
myPort.write((byte) count);
if (count==16) count = 0;
else count++;
}
and the FPS turns out to be exactly 4 (16 pixels updats in 4 seconds).