问题
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