serial_get_info(id)
Features
This function reads the port information and device name of the connected USB to Serial.
Parameters
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
id | int | 1 | ID of "USB to Serial" to read (1-10) |
Return
Value (port_info, device_name) | Description |
---|---|
port_info | Port information (NULL means no device is connected) |
device_name | Device name (NULL means no device is connected) |
Exception
Exception | Description |
---|---|
DR_Error (DR_ERROR_TYPE) | Parameter data error occurred |
DR_Error (DR_ERROR_VALUE) | Parameter value is invalid |
Example
port_info, device_name = serial_get_info(1) #1 connected device information
#port_info = "COM_USB"
ser = serial_open(port=port_info, baudrate=115200, bytesize=DR_EIGHTBITS,
parity=DR_PARITY_NONE, stopbits=DR_STOPBITS_ONE)