/* Datalogger - modified Tom Igoe Datalogger Code and from Nont: http://itp.nyu.edu/physcomp/sensors/Class/Sl974 */ import processing.serial.*; Serial myPort; // The serial port // initial variables: int i = 2; // counter int inByte = -1; // data from serial port void setup () { size(350, 280); // window size // List all the available serial ports println(Serial.list()); //I use COM4 so I open Serial.List()[1] myPort = new Serial(this, Serial.list()[0], 16468); // set inital background: background(255); } void draw () { if (myPort.available() > 0) { inByte = myPort.read(); serialEvent(); } } void serialEvent () { // draw the line: stroke(255,2,2); line(i, height, i, (height - inByte)-20); println (inByte); // at the edge of the screen, go back to the beginning: if (i >= width) { i = 0; background(100); } else { i++; } }