Command Arduino Uno using Ardulink in a JAVA application

hello,

I am trying to command my Arduino Uno using Ardulink library in my JAVA application but without success I don't know what have I missed, here is my code:

Link link = Link.getDefaultInstance();
boolean connected = link.connect("COM6", 57600);
Thread.sleep(2000);
MessageInfo msg=link.sendPowerPinSwitch(17, IProtocol.POWER_HIGH);
Thread.sleep(5000);
link.disconnect();

In arduino example, it uses this functions of the Servo class to command:

attach(port);pinMode(A3,OUTPUT); digitalWrite(A3, HIGH);
write (135)

Here is the exception that I got:

Exception in thread "Thread-2" java.lang.ArrayIndexOutOfBoundsException: 1024
    at org.zu.ardulink.connection.serial.AbstractSerialConnection$SerialReader.run(AbstractSerialConnection.java:224)
    at java.lang.Thread.run(Unknown Source)

It looks like your Java app is trying to access an array incorrectly. Perhaps the fine folks at http://snippets-r-us.com could help you.

Post the complete code.

However if you are getting a Java error you should be asking on a Java forum.

…R