Object reference

SerialPort

The SerialPort object, its operations, examples and notes.

Object description

SerialPort provides cross-platform serial communication and replaces the former lib.serial plugin. Use SerialPort::list_ports() to discover ports or construct one from its system name.

Availability: SerialPort was added to ZPE in version 1.14.11. Its methods require permission level 3.

Public properties

  • system_name

    The read-only operating-system port name.

  • name

    The read-only descriptive port name.

  • baud_rate

    The current baud rate; this property can be changed before opening the port.

Example

YASS
$ports = SerialPort::list_ports()
$port = $ports[0]
$port->open()
$port->write("Hello")

Object functions