Hi,
I have what I think is one of the simplest things you can do with the Arduino and Processing.
My Arduino program opens up a com port, writes a number (using Serial.println()), and then delays for a bit. Repeat.
On the Processing side I create a new Serial object (using the same com port and baud rate the Arduino is configured to) and then wait for data using readStringUntil('\n').
Everything is fine on the Arduino side - I can see what I expect in the Serial Monitor. But as soon as I start the Processing side of the equation there are tons of extra digits sent to the Arduino's Serial Monitor window???
Would someone please check out my code to see if I am doing something ridiculous? Also, I should mention that every time I start my Processing app this message is reported: "RXTX Warning: Removing stale lock file. /var/lock/LK.046.018.014".
Thanks!
LT
Arduino side:
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println(10);
delay(500);
}
Processing side:
import processing.serial.*;
Serial g_port;
void setup()
{
size(480, 120);
// This is the serial port that the Arduino opens
g_port = new Serial(this, "/dev/tty.usbmodem1421", 9600);
g_port.bufferUntil('\n');
}
void draw()
{
// Nothing going on yet
}
void serialEvent (Serial port)
{
int val = int(port.readStringUntil('\n'));
}