Hamdi
Hamdi

Reputation: 5

Using arduino serial monitor while the port is busy with another java program?

In one of the projects I am doing, I need to send some data from a Java program to an Arduino board. I am using serial communication with the JSerialComm library.

I need to debug my program to see whether the Arduino is receiving the correct data or not and I cannot find a way to do it because while sending the data, the Java program is using the serial port, therefore I cannot open the serial monitor and print information in the Arduino IDE.

Do you have any other idea to check the data getting to the Arduino from the serial port?

Upvotes: 0

Views: 1392

Answers (2)

Saurabh P Bhandari
Saurabh P Bhandari

Reputation: 6742

Just print the data which you are receiving from the Java program in your C/C++ program (assumption) which is uploaded to the Arduino. Also in the Java program once you are done sending data, just listen to the serial port to check if the data sent is same as data received.

Refer to this for Usage examples for JSerialComm library, Link

Update: You can print data in your Arduino program using Serial.print() (if it is C/C++ program). You don't have to use the serial monitor. You can directly read data from the serial port in Java using JSerialComm library, once you are done sending data to Arduino

Upvotes: 1

Marcos G.
Marcos G.

Reputation: 3496

If you want something different from the obvious but probably best answer given by Saurabh P Bhandari you can try with a port sniffer. Maybe not your case, but I can imagine a scenario where you don't have access to the source code of the program using the serial port.

Those are expensive, so if you want to go for the cheap you can take a look at the software alternative I proposed here, which exploits port forwarding to monitor the traffic.

If you're on Linux there are also ways to do the same.

Upvotes: 0

Related Questions