...
port As Integer
: The port enumeration of the serial device:- Most standard serial devices (including the USB-serial port on the LS424) enumerate on port 0.
- To communicate with the serial port of an OPS display (i.e. with the HO523), use port 1.
- To communicate with a USB-serial device (such as a GPS receiver), use port 2.
port As String
: If multiple USB-serial devices are connected to the player, the device can be specified with a raw value ("RAW:<raw_enumeration>"
) or a friendly name ("USB:<friendly_name>"
). These values correspond This value corresponds to the<raw>
and<fid>
values value returned by the roDeviceInfo.GetUSBTopology() method. The BrightSign shellusblist
command can be used to discover friendly names. Note that RAW names are not guaranteed to stay the same between products or OS versions, so they are not recommended.baud_rate As Integer
: The baud rate for serial communication. The serial port supports the following baud rates: 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400.
Code Block | ||
---|---|---|
| ||
serial1 = CreateObject("roSerialPort", 0, 115200) serial2 = CreateObject("roSerialPort", "RAWUSB:4-1:1.0A/1", 57600) |
The roSerialPort object sends the following event types:
...
Returns the user data that has previously been set via SetUserData()
. It will return Invalid if no data has been set.
...
This example script waits for a serial event and echoes the input received on the serial port to the shell:
...
Code Block |
---|
serial = CreateObject("roSerialPort", 0, 9600) p = CreateObject("roMessagePort") serial.SetLineEventPort(p) serial_only: msg = Wait(0,p) ' Wait forever for a message. if(type(msg) <> "roStreamLineEvent") goto serial_only 'Accept serial messages only. serial.SendLine(msg) ' Echo the message back to serial. |