Best approach and methods for serial communication (Python)

Hi,
I am currently trying to create a simple instrument which opens a Serial connection to a specific COM port and baudrate. I am currently attempting to open the connection using PySerial, but I suspect it is not the best approach for OpenTap development.

Is there a way to do this with the “built-in” .Net/C# package interfaces?

If not, then let’s say I have a ComPort property(String, "COM3") from which I want to extract the value to enable in a
ser = serial.Serial()
connection as
ser.port = *extract*(ComPort)
Would there be a way to do this?

I am developing the Instrument in Python.

Any help is much appreciated!

.NET supports serial ports. Here’s some pseudocode:

using System.IO.Ports;

var port = new SerialPort();

// here you should set the port's properties, like PortName, BaudRate, Parity, DataBits, StopBits, Handshake, ReadTimeout, WriteTimeout, etc.

port.Open();

port.Write("some command");
1 Like