When it comes to Arduino, there are several ways to do things. Using simple Arduino IDE to communicate with the board through serial port. Write a Java program to do it, or maybe do send orders to Arduino through your program that is not uploaded on Arduino card and can be changed anytime without even updating the pde file on the board. The tool that gives you the power to do this is called Processing & the library used exactly for Arduino is called StandardFirmdata. The very good thing about Processing is that it is based on Java and all Java codes works right out of the box on it. You can also import processing libraries into your Java framwork and enjoy the power of processing right in the middle of your Java project(in Eclipse).
The instruction to get Processing & Arduino talk together :
- Download this file.
- Unzip the library and copy the “arduino” folder into the “libraries” sub-folder of your Processing Sketchbook. (You can find the location of your Sketchbook by opening the Processing Preferences. If you haven’t made a “libraries” sub-folder, create one.)
- Run Arduino, open the Examples > Firmata > StandardFirmata sketch, and upload it to the Arduino board.
- Configure Processing for serial:http://processing.org/reference/libraries/serial/
- In Processing, open one of the examples that comes with with the Arduino library(in the same folder that we just unzipped).
- Edit the example code to select the correct serial port.
- Run the example.