obarlas

Processing US

Jan 14th, 2013
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. import processing.serial.*;
  2.  
  3. Serial commPort;
  4. int X = 0;
  5. int pX = 0;
  6. int Y = 0;
  7. int pY = 0;
  8.  
  9. void setup()
  10. {
  11. //println(Serial.list());
  12.   commPort = new Serial(this, Serial.list()[4], 9600);
  13.   size(800, 600);
  14.   background(255);
  15. }
  16.  
  17. void draw()
  18. {
  19.     Y = commPort.read();
  20.     println(Y);adoad
  21.     line(pX, pY, X, Y);
  22.     pX = X;
  23.     pY = Y;
  24.     X++;
  25.     if (X > 800) {
  26.       X = 0;
  27.       background(255);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment