import processing.serial.*; String serial_port="COM3"; Serial serial; String serialString=""; //last read string int serial_endchar=10; //10=ASCII Linefeed static int SERVO_COUNT=5; int servoPositionsActual[]=new int[SERVO_COUNT]; PrintWriter fileoutput; String recorddir="recordings/"; boolean recording=false; String filename=""; int recordingStartTime; int linesWritten; void setup() { size(800,600); background(0); printArray(Serial.list()); // Open the port you are using at the rate you want: serial = new Serial(this, serial_port, 57600); serial.clear(); // Throw out the first reading, in case we started reading // in the middle of a string from the sender. println("readUntil"); serialString = serial.readStringUntil(serial_endchar); println("read:"+serialString); serialString = null; } void draw() { clear(); textSize(30); textAlign(LEFT); text("Press R to start recording.\nPress S to stop recording.",20,height-70); int valRange=1024; //maximum value for bargraph scale String[] list=readSerial(); if (list!=null) { if (list[0].equalsIgnoreCase("dxlgp")) { //is position message boolean firstValueWritten=false; for (int i=1;i 0) { serialString = serial.readStringUntil(serial_endchar); //println("read:"+serialString); if (serialString != null) { println(serialString); String[] list = split(serialString, ','); return list; } } return null; }