Serial Module
See also: Serial Port Class serialport portName) serialport 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.

See the documentation for the Serial Port Class to learn how to use this object.

local port,errMsg ="COM7"); -- Open COM7 with a default baud rate of 9600 local port2,errMsg2 ="COM8", 115200); -- Open COM8 with baud rate of 115200 if( not port ) then printf("Failed to open COM7: %s\n", errMsg); end if( not port2 ) then printf("Failed to open COM8: %s\n", errMsg2); end

Page last updated at 2018-09-25 20:48:24

Copyright 2024