This is the multi-page printable view of this section. Click here to print...

Return to the regular view of this page

As of 2025-07-24

mwSerial.py

Class for managing serial port operations

    Class MWSerial

    This class manages serial port operations such as reading and writing.

    Parameters for Definition

    Initial values are set and do not need to be specified.

    NameTypeDefaultDescription
    portstringNone

    Name of the serial port to open

    e.g., COM3, /dev/ttyUSB0

    baudint115200Baud rate
    timeoutfloat0.1Timeout duration for serial communication (in seconds)
    parityintserial.PARITY_NONESpecify parity
    stopint1Stop bit
    byteint8Data bit length
    rtsctsint0Set to 1 to enable RTS and CTS
    dsrdtrint0Set to 1 to enable DSR and DTR
    modestringAsciiThis value is fixed to Ascii

    SerialSelect

    Searches for serial ports connected to the PC and prompts the user to select one.

    If only one port is available, it is automatically selected.
    If no ports are found, None is returned.
    If a port name is passed as an argument, that port will be used.

    Parameters

    NameTypeDefaultDescription
    portnamestringNone

    Name of the serial port to open (e.g., COM3, /dev/ttyUSB0)

    Leave unspecified for automatic selection.

    Return Value

    None