Module jls.io.Serial

Provides serial input/output communication.

Class Serial

serial:readStart (stream) Starts reading data on this serial device.
serial:readStop () Stops reading data on this serial device.
serial:write (data[, callback]) Writes data on this serial device.
serial:writeSync (data) Writes data on this serial device.
serial:close ([callback]) Closes this serial device.
serial:closeSync () Closes this serial device.
Serial:open (name, options) Returns a new Serial for the specified name.


Class Serial

A Serial class. A Serial instance represents a serial device.
serial:readStart (stream)
Starts reading data on this serial device.

Parameters:

serial:readStop ()
Stops reading data on this serial device.
serial:write (data[, callback])
Writes data on this serial device.

Parameters:

  • data string the data to write.
  • callback function The optional callback. (optional)

Returns:

    a Promise or nil if a callback has been specified.
serial:writeSync (data)
Writes data on this serial device.

Parameters:

  • data string the data to write.
serial:close ([callback])
Closes this serial device.

Parameters:

  • callback function The optional callback. (optional)

Returns:

    a Promise that resolve when closed or nil if a callback has been specified.
serial:closeSync ()
Closes this serial device.
Serial:open (name, options)
Returns a new Serial for the specified name. The name is OS dependend, /dev/ttyUSB0 for Linux and COM3 for Windows

Parameters:

  • name string The name of the serial device to open.
  • options The serial options.
    • baudRate number The baud rate.
    • dataBits number The number of bits transmitted and received.
    • stopBits number The number of stop bits to be used.
    • parity number The parity scheme, 0 for no parity.

Returns:

    a new Serial or nil.
generated by LDoc 1.4.6