We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am writing a program, to get serial input string and then add three COMMAs with it. but I am facing a problem of a line gap (carriage return+linefeed) b/w string and COMMAs. Can you plz guide me on how do I resolve this problem and remove the line gap. below in my code.
import processing.serial.*; Serial serialPort; String input; void setup() { serialPort = new Serial(this,"COM4",9600); serialPort.bufferUntil('\n'); } void draw() { background(1); } void serialEvent(Serial serialPort) { input = serialPort.readString(); for (int i=0 ; i<3; i++) { input = input + ","; } println(input); }
Answers
Dunno if I'm understanding it right, but mebe 2 trim() calls would remove the CR + LF endings? :-??
Worth a try, right? 8-X