import processing.serial.*; Serial port; // Create object from Serial class int val; // Data received from the serial port int[] values; float zoom; void setup() { size(1280, 480); // Open the port that the board is connected to and use the same speed (9600 bps) print(Serial.list()); port = new Serial(this, Serial.list()[0], 9600); values = new int[width]; zoom = 1.0f; smooth(); } int getY(int val) { return (int)(height - val / 1023.0f * (height - 1)); } int getValue() { int value = -1; while (port.available() >= 3) { if (port.read() == 0xff) { value = (port.read() << 8) | (port.read()); } } return value; } void pushValue(int value) { for (int i=0; i