Java to Esplora Serial port communication issue

我的梦境 提交于 2019-12-12 02:19:37

问题


I am attempting to communicate between an Arduino Esplora and a Java process using the RXTXComm library that comes bundled with the Arduino IDE.

I have started with the code here. Based on this question I have modified my Arduino code to be

void setup(){
    Serial.begin(9600);
    while(!Serial);
}
void loop(){
    Serial.println("Test");
}

Communication consistently works with an Arduino UNO. However, Communication with an Arduino Esplora often produces no output, and when it does work, it quickly terminates with the message java.lang.IOException: underlying stream returned 0 bytes. When I use the Arduino IDE Serial monitor, it returns the proper output from both an Arduino UNO and an Arduino Esplora.

How can I ensure consistent and uninterrupted communication between the Esplora and my Java process?

来源:https://stackoverflow.com/questions/31689079/java-to-esplora-serial-port-communication-issue

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