system.serial.closeSerialPort
This function is used in Python Scripting.
Descriptionβ
Closes a previously opened serial port. Returns without doing anything if the named serial port is not currently open. Will throw an exception if the port is open and cannot be closed.
Client Permission Restrictionsβ
This scripting function has no Client Permission restrictions.
Syntaxβ
system.serial.closeSerialPort(port)
Parametersβ
| Type | Parameter | Description |
|---|---|---|
| String | port | The name of the serial port, e.g., "COM1" or "dev/ttyS0". |
Returnsβ
Nothing
Scopeβ
Gateway, Vision Client, Perspective Session
Code Examplesβ
Code Snippet - Using a Literal Value
# This example will close a port called "COM1".
system.serial.closeSerialPort("COM1")
Code Snippet - Using a Variable
# This example will close a port using a variable called port that has a value of "COM1"
port = "COM1"
system.serial.closeSerialPort(port)