0

I have created an gui in python using pyserial to communicate with Arduino but my serial monitor does not show up it says (Serial port busy) whenever I run the gui.

The gui works fine but when I want to see the printed data for that, I am using an external LCD but I was wondering if there was a way to see the data in serial monitor. If not could you explain why? I have no idea whatsoever why is this happening.

1
  • 1
    AFAIK each serial port can only be open from at most one program at a time. are you sure that arduino IDE or another application is not using this port whan you try to open it? have you tried opening this serial port from a program like hyperTerminal? what happened? have you tried opening with your python application another serial port? what happened?
    – foivaras
    May 3, 2016 at 9:24

2 Answers 2

1

The problem is simple, you are dealing PySerial using the serial communication port arduino, so you can not communicate with Arduino IDE and python at the same time.

Solution:

In the program you should print python q values you need, with the Print command, so you'll see in the CMD same as you see in the Arduino serial monitor.

0

If an application is already using the serial port then you won't be able to reopen it. In this case you Python GUI is communicating with the Arduino over the serial port, so the IDE can't. Think back to when you are just using the IDE, the serial monitor is closed whenever you upload a new version of the code to the board.

So, how do you solve it. The simplest answer is to use another serial port for the Python app to talk to the Arduino and leave the default port free for the Arduino IDE/Serial monitor. Software serial should work, you might need to print to both serial ports from the Arduino, but you can do that by adding another function.

An alternative might be to modify your python app to rebroadcast the debug data to another serial port and then connect to this via hyper terminal.

Hope that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.