/** * Simple Read for LM35 sensor * * I modified the 'simple read' sketch * increased the mapped range to 200 to increase the visual change in motion for this example */ import processing.serial.*; Serial myPort; // Create object from Serial class int val; void setup() { size(200, 200); // I use an Ubuntu OS based laptop // and the correct portname is ttyUSB0 // // String portName = Serial.list()[1]; myPort = new Serial(this, portName, 9600); } void draw() { background(0); if ( myPort.available() > 0) { // If data is available, val = myPort.read(); // read it and store it in val println(val); } val=(int)map(val, 30, 70, 0, 200); ellipse(val, 10, 20, 20); }