Regular API function

simSerialOpen / sim.serialOpen

Description 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 synopsis simInt simSerialOpen(simChar* portString,simInt baudRate,simVoid* reserved1,simVoid* reserved2)
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 NULL.
reserved2: reserved for future extension. Keep at NULL.
C return value
-1 if operation was not successful, otherwise a port handle
Lua synopsis number result=sim.serialOpen(string portString,number baudRate)
Lua parameters
Same as C-function
Lua return values
Same as C-function

All regular API functions on one page