Hi to everyone.
So, I'm using Processing to communicate with an Arduino through a Bluetooth serial port.
I'm trying to understand why when I write bytes to the Serial port, it's very slow.
Here's an example to understand:
- import processing.serial.*;
- Serial myPort;
- byte arr[] = {0,1,2,3,4,5,6,7,8,9,
- 0,1,2,3,4,5,6,7,8,9,
- 0,1,2,3,4,5,6,7,8,9,
- 0,1,2,3,4,5,6,7,8,9,
- 0,1,2,3,4,5,6,7,8,9};
- void setup()
- {
- size(400, 600);
- myPort = new Serial(this, "/dev/tty.HC-05-DevB", 57600);
- }
- void draw()
- {
- myPort.write(arr);
- //myPort.write((byte)1);
- println(millis());
- }
- 3183
- 3200
- 3401
- 3652
- 3902
- 4152
- 4402
- 4652
- 4902
- 5152
- 5402
- 5655
- 5902
- 6152
- ..
How can this be possible? If the max speed is 4 bytes per second, how it comes that i can send 4 frames of 50 bytes in one second?
Thank you for the help, I've also tried looking in the Processing source code to understand how this works but no luck..