Serial communication from arduino to processing- error (" port.readStringUntil(end); ")

edited December 2013 in Questions about Code

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

Sign In or Register to comment.