Serial Module

From SolarStrike wiki
Revision as of 20:27, 26 February 2018 by Elverion (talk | contribs) (Created page with "See also: Serial Port Class == open == '''serialPort serial.open(string portName)''' '''serialPort serial.open(string portName, number baudRate)''' Opens a serial port b...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

See also: Serial Port Class

open

serialPort serial.open(string portName) serialPort serial.open(string portName, number baudRate)

Opens a serial port by it's name. The portName should not contain the "\\.\" prefix as this is provided for you. You may optionally provide a baud rate, otherwise it will default to 9600.

If this function succeeds, a new serial port object will be returned. If this function fails, it returns false plus an error message.


Example:

local port = serial.open("COM7"); -- Open COM7 with a default baud rate of 9600
local port2 = serial.open("COM8", 115200); -- Open COM8 with baud rate of 115200