import processing.serial.*; Serial myPort; // Create object from Serial class int lf=10; String inString="0,0"; // Input string from serial port int dataSensor; int MapSensor; void setup() { size(500, 300); myPort = new Serial(this, "/dev/ttyUSB0", 9600); myPort.bufferUntil(lf); } void serialEvent(Serial myPort) { inString = (myPort.readString()); inString=trim(inString); } void draw() { background(0); text("received: " + inString, 1, 220); String[] list = split(inString, ','); text("length: " + list.length, 1, 250); text("channel1: " + list[0], 1, 30); text("chanell2: " + list[1], 1, 110); // print slidebar fill(0, 255, 0); dataSensor=int(trim(list[0])); MapSensor= (int)map(dataSensor, 0, 1023, 2, 300); rect(100, 20, MapSensor, 25); dataSensor=int(trim(list[1])); MapSensor= (int)map(dataSensor, 0, 1023, 2, 300); rect(100, 100, MapSensor, 25); } ------------------------------------------------------------------- ================================================================== const int analogInCh1 = A10; const int analogInCh2 = A11; int sensorCh1 = 0; // value read from the pot int sensorCh2 = 0; // value read from the pot char string[20]; void setup() { Serial1.begin(9600); } void loop() { sensorCh1 = analogRead(analogInCh1); sensorCh2 = analogRead(analogInCh2); sprintf(string,"%d,%d", sensorCh1,sensorCh2); Serial1.println(string); sprintf(string,"sensor1: %4d", sensorCh1); sprintf(string,"sensor2: %4d", sensorCh2); delay(10); }