document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import processing.serial.*;
  2.  
  3. Serial myPort; // The serial port
  4.  
  5. void setup() {
  6. // List all the available serial ports
  7. printArray(Serial.list());
  8. // Open the port you are using at the rate you want:
  9. myPort = new Serial(this, "/dev/ttyUSB2", 9600);
  10. size(1000, 600);
  11.  
  12. frameRate(30);
  13. noStroke();
  14. }
  15.  
  16. void draw() {
  17. background(220);
  18. while (myPort.available() > 0) {
  19. int inByte = myPort.read();
  20. int inByte1 = myPort.read();
  21. int inByte2 = myPort.read();
  22.  
  23.  
  24. int val = (inByte+inByte1+inByte2)/3;
  25. println(val);
  26.  
  27.  
  28. fill(100);
  29. rect(200, 300, 100+val*2, 100);
  30.  
  31.  
  32.  
  33.  
  34.  
  35. }
  36. }
');