


Also, you might need to change the line that sets port_name in order to specify the correct serial port. The Jrk’s input mode should be set to “Serial / I2C / USB”, or else the “Set target” command will not work. It demonstrates how to set the target of the Jrk by sending a “Set target” command and how to read variables using a “Get variables” command. Let me know if my understanding is correct and if the above pointers help your issue.The example Python code below uses the pySerial library to communicate with the Jrk G2 via serial. Closing that software would remove the error and you should be able to interact with PSoC. If the issue is the port access getting denied that it is because you might have the port already open in another software like a terminal.

From the Python script, you can access the python interface COM port. Connect the python interface pins to either a USB-Serial interface or another kit's UART pins (could be any kit that supports USB-UART interface - make sure the primary device in that kit does not load the UART lines). Connect the printf interface to P5.0/1 and the Python interface to another port pin.ģ. Use two UART blocks inside PSoC - one for Python interface and another for terminal/printf interfaceĢ. If my understanding is correct, you are trying to write to the same COM port from python which you have opened in another terminal software? And you want to push something to PSoC from Python and likely want to see the data in a terminal?ġ. And I need the PSOC to take these coordinates and do stuff in response to the passed information. Is there some other way to do write from a python script and read that information into my PSOC? For my application, I have a script in Python that outputs coordinates. However, I have the issue that my python script will throw an error because the port is already open and I am not able to write to the COM port. Theoretically, I thought that if my python script wrote to a Com port, and my UART was connected to that same COM port, I'd be able to read information in. Then within PSOC file, I have a UART that is able to read and write from a Com port too. For testing, currently just trying to send the letter "a".)

(Below is what I added to my python script. I'm currently trying to open a Serial com port in my python script, and write to that com port. I'm trying to pass in information from a python script run on my computer to my psoc device (I'm on a Windows computer).
