Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scripting_function


Panel
titleDescription

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 permissions restrictions


Panel
titleSyntax

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

  • Parameters

String port - The previously configured serial port to use.

Integer timeout - Maximum amount of time, in milliseconds, to block before returning. Default is 5000. [optional]

String encoding - The String encoding to use. Default is UTF8. [optional]

  • Returns

String - A line of text.

  • Scope

Gateway, Vision Client, Perspective Session

Panel
titleCode Examples
There are no examples associated with this scripting function.
Code Block
# This example will read from the "COM1" port and set the timeout to 10000 milliseconds.
port = "COM1"
timeout = 10000
system.serial.readLine(port,timeout)
Panel
titleKeywords

system serial readLine, serial.readLine