Command Arduino Uno using Ardulink

廉价感情. 提交于 2019-12-11 01:33:54

问题


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)

来源:https://stackoverflow.com/questions/33688838/command-arduino-uno-using-ardulink

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!