Class serial

Read data on serial ports.

local mserial = require 'melisma.serial'

mserial.open {
    path = '/dev/ttyACM0',
    callback = print,
}

Functions

serial.open(conf) Open a serial port.


Functions

Methods
serial.open(conf)

Open a serial port.

conf is a table containing the following keys:

  • path (string, required): Path to serial port (e.g. /dev/ttyACM0).
  • callback (function, required): Callback function for handling messages.
  • baud (integer); baud rate (default 9600).
  • format (string): frame format (default '8N1').
  • encoding (string): method for encoding messages (default 'cstring'). May be one of:
    • 'cstring': NULL-terminated strings.

Parameters:

Returns:

    serial
generated by LDoc 1.5.0 Last updated 1980-01-01 00:00:00