Regular API function

simSerialOpen / sim.serialOpen

Description Lua only. Opens a serial port (RS-232) for communication. When called from a script, the function can only be called when the simulation is running (and in that case the port is automatically closed at simulation stop). See also sim.serialClose, sim.serialSend, sim.serialCheck and sim.serialRead.
C/C++
synopsis
simInt simSerialOpen(simChar* portString,simInt baudRate,simVoid* reserved1,simVoid* reserved2)
C/C++
parameters
portString: a string specifying the port to open. Under Windows, use something similar to "\\.\COM1". Under MacOS and Linux, use something similar to "/dev/*" (check the "/dev" folder to know what file to specify). Under Linux, you might have to launch CoppeliaSim with super user priviledges in order to access the serial port.
baudRate: the baudrate
reserved1: reserved for future extension. Keep at nullptr.
reserved2: reserved for future extension. Keep at nullptr.
C/C++
return value
-1 if operation was not successful, otherwise a port handle
Lua
synopsis
int result=sim.serialOpen(string portString,int baudRate)
Lua
parameters
Similar to the C-function counterpart
Lua
return values
Similar to the C-function counterpart
Python
synopsis

<