Skip to main content
Version: 7.9

system.serial.readLine

This function is used in Python Scripting.

Description

Attempts to read a line from a serial port. A "line" is considered to be terminated by either a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a line feed.

The function will wait until the timeout period for a terminator. If the timeout is reached before the line is properly terminated, then the buffer will be dumped, possibly resulting in data loss.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.serial.readLine(port [, timeout] [, encoding])

Parameters

TypeParameterDescription
StringportThe previously configured serial port to use.
inttimeoutMaximum amount of time, in milliseconds, to block before returning. Default is 5000. [optional]
StringencodingThe String encoding to use. Default is UTF8. [optional]

Returns

String - A line of text.

Scope

All