Saturday, August 2, 2014

Using Java RxTx library for Serial Communication With Arduino - Part 2

Hi All,

In the previous post I showed you how you can use the Java RxTx library to find the Arduino connected COM port. Now let's do something useful. We can use this for reading values sent from the Arduino. With the values, we can play around and do whatever we like. In this post I'm using the code provided by Arduino.

First let's write a tiny Arduino program that prints some strings to Serial.



Then lets use the code provided by Arduino for reading values from Arduino. So here it is. I have just modified the code to split the chunks from the input string. (Line 81)



So that it.

Hope it would help.

Thank you. :-)




5 comments:

  1. So? Finish? Only this two tutorial :(

    ReplyDelete
    Replies
    1. Hi Paolo, sorry to disappoint you. :-) But you could also try my next blog post on showing arduino data in JFreeChart. Will try to do some more.

      Delete
  2. What about writing data to the arduino? I have tried using the output stream from the serial port to write data but my arduino seems to never receive it. I have assumed it has something to do with the baud rate on my computer vs my arduino, but I am unsure of this.

    ReplyDelete
  3. So The RxTx library can communication with other microprocessor?

    ReplyDelete
  4. hi
    i test this example but i have this error
    "Failed to write core dump. Minidumps are not enabled by default on client versions of Windows"

    ReplyDelete