Java GUI and Arduino - Extract Information from Serial
<p>I am currently working in an Arduino project. In which I need to read 5 analog sensors. </p>

<p>The arduino code for each sensor its really simple. But it is the following:</p>

<pre><code>void setup() 
 {
  Serial.begin(9600);
 }

void loop() 
 {
 int sensor1 = analogRead(A0);
 float volt1 = sensor1 * (5.0 / 1023-0);
 Serial.print("The voltage on the sensor  1 is:   ");
 Serial.println(volt1);
 }
</code></pre>

<p>Using the Java documentation found on the Arduino Website <a href="http://playground.arduino.cc/Interfacing/Java" rel="nofollow">http://playground.arduino.cc/Interfacing/Java</a> I was able to set up the Rx and Tx libraries. And I was also able to get data from the serial port in the Java Console. What I need to do now is to extract that information from the console and display it on a GUI.</p>

<p>In the Java console I have:</p>

<p>The voltage on the sensor  1 is: X<br>
The voltage on the sensor  2 is: Y 
The voltage on the sensor  3 is: Z<br>
The voltage on the sensor  4 is: W<br>
The voltage on the sensor  5 is: A</p>

<p>And I need to put the values of X, Y, Z, W and A each one on a different JTextField </p>

<p>Thanks for the help</p>