We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi there, I am taking readings from a maxbotix distance sensor from arduino and wish to communicate numbers (ints) via serial to processing without firmata. The sensor details are being printed in to the arduino serial window (correct baud rate etc). I've tried a number of processing serial communication examples and am getting error codes re "serial = port.readStringUntil(end);" the error message is "The function readStringUntil(int) does not exist." Is that function deprecated in processing 2.0 or should I maybe be taking a different approach to numeric information?
///Extract from Processing Code:
import processing.serial.*;
int end = 10;
String serial;
Serial port;
void setup() {
port = new Serial(this, Serial.list()[0], 9600);
port.clear(); serial = port.readStringUntil(end);
serial = null;
}
void draw() {
while (port.available() > 0) {
serial = port.readStringUntil(end);
}
///////////////////////
extract from arduino code :
void loop()
{
unsigned long start;
start = millis();
int x=rangeSensorPW.getRange();
Serial.print(x);
Serial.print(",");
Serial.println();
delay(250);
}
Answers
Yes readuntil function is broke in processing2.1 it will work in processing 2.03 or earlier. there are also other serial problems with 2.1.
thanks,I noticed another thread about this after posting, for anyone else its here: forum.processing.org/two/discussion/838/function-readstringuntilint-does-not-exist#Item_14
hi, in the end I used processing 1.51 for this.
Processing release 2.1.1 fixes the readStringUntil() issue.