Hack Forums
[Java] Arduino Processing Java - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Java] Arduino Processing Java (/showthread.php?tid=6020044)



Arduino Processing Java - Nemo2478 - Oct 28, 2019

Hello everybody,

i want to reach that values represent themselves via processing from the counter. My problem is that my Arduino output is X20, Y20 (step) and I want the output to be displayed on two surfaces. One for X and a second for Y. How should I achieve the same in processing as in my Arduino?
Code
char Serial_in;
int X_Serial_value;
int Y_Serial_value;
……………………………………
// If there is "X" or "x" in Serial, parseInt() will extract the value for X_serial_value from Serial.

while (Serial.available())
{ Serial_in = Serial.read();
if (( Serial_in == 'X' ) ^ (Serial_in == 'x')) { X_Serial_value = Serial.parseInt(); }
else
if (( Serial_in == 'Y' ) ^ (Serial_in == 'y')) { Y_Serial_value = Serial.parseInt(); }


Regards and thanks