Port:close() method

Close the serial communication Port.

Notes

  • Once garbage collected, the serial Port object will be automatically closed.

Return value

This method returns no value.

Example

local serial = require "serial" local COM1 = serial.Port("COM1") if COM1:open() then print("COM1 serial port is now open") COM1:write("First message"):wait() COM1:close() else print("Failed to open COM1 serial port") end