Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : Serial Library and Arduino

$
0
0
Sketch:
  1. import processing.serial.*;
  2. Serial myPort;
  3. byte arr[] = {0,1,2,3,4,5,6,7,8,9};

  4. void setup() 
  5. {
  6.   size(400, 600);
  7.   myPort = new Serial(this, "/dev/tty.HC-05-DevB", 57600);
  8.   while (true)
  9.   {
  10.       println("SA " + millis());
  11.       myPort.write(arr);
  12.       println("EA " + millis());
  13.       println("SB " + millis());
  14.       myPort.write((byte)1);
  15.       println("EB " + millis());
  16.   }
  17. }

  18. void draw()
  19. {
  20. }
Result:
  1. SA 3314
  2. EA 3314
  3. SB 3315
  4. EB 3324
  5. SA 3324
  6. EA 3453
  7. SB 3453
  8. EB 3703
  9. SA 3703
  10. EA 3953
  11. SB 3953
  12. EB 4203
  13. SA 4203
  14. EA 4453
  15. SB 4453
  16. EB 4703
  17. SA 4703
  18. EA 4953
  19. SB 4953
  20. EB 5203
  21. SA 5203
  22. EA 5453
  23. SB 5453
How the hell can be sending 10bytes faster than sending a single one?

Viewing all articles
Browse latest Browse all 1768

Trending Articles