Dunno much about Arduino, but it seems correct to me. ![]()
Although you can simplify it a lil’ more like this: ![]()
Serial.print(x1);
Serial.write('\t');
Serial.println(y1);
I’m also noticing you’re sending 2 int values, not float 1s: ![]()
int x1 = map(x, 1023, 0, -10, 10);
int y1 = map(y, 0, 1023, -10, 10);
So it’ll be more efficient to replace all float to int in the Processing side as well. ![]()
Also in your Processing code side, I’ve spotted some bugs which wouldn’t be there if you had followed my own sketch model more closely! ![]()
Where’s Serial::bufferUntil() after this statement: ![]()
port = new Serial(this, "COM12", 115200);
And do not use Serial::available() when using serialEvent()! ![]()