Electronic – Java and Serial Port

avrjava

I am able to control the speed and direction of 2 DC motors using an AVR-based microcontroller board (see here for details) currently through hyperterminal (Flash Magic).

Is it possible to do the same through a Java-based GUI program instead?

I mean the speed entered in the textfield of the GUI being sent to the COMPort instead of the one entered in hyperterminal. If so, how?

Best Answer

There are com-port libraries available for java.

RXTX seems to be one of the most prominent.
Here is a long discussion about how to use RXTX and an alternative, called JavaComm.
Here is a question on StackExchange asking essentially exactly what you are asking.


Note: I'm assuming you want to write a java application to do what you describe (otherwise, why would the application being java-based be relevant?)

If not, please update your question.


Edit:

If you're in control of the USB-serial converter, you could use the jD2XX library, which wraps the FTDI D2XX driver API.

This is an excellent API, but it will only work with FTDI usb-serial converters.