Serial
Module that allows communication through the serial port.
Properties
Determines the type of data received by the SerialReceiveEvent event.
The BinaryData option passes binary data into the event's Data property.
The Lines option splits the received data into lines using the \n character as a separator, writing the result inside the event's Lines property.
Serial COM port number.
Indicates if the serial connection on the specified port is active.
The serial connection baud rate.
The standard length of data bits per byte.
The value must be between 5 and 8 inclusive.
The serial connection parity-checking protocol.
The number of stopbits per byte.
Methods
Writes an 8-bit integer to the serial port.
WriteUInt8( value number )
Writes an 8-bit unsigned integer to the serial port.
WriteInt16( value number )
Writes a 16-bit integer to the serial port.
WriteUInt16( value number )
Writes a 16-bit unsigned integer to the serial port.
WriteInt32( value number )
Writes a 32-bit integer to the serial port.
WriteUInt32( value number )
Writes a 32-bit unsigned integer to the serial port.
WriteFloat32( value number )
Writes a 32-bit float to the serial port.
WriteFloat64( value number )
Writes a 64-bit float to the serial port.
Writes a byte array to the serial port.
Write a utf8 string to the serial port.
Writes a string with a \n (new line) added at the end to the serial port.
Returns an array containing the available serial COM port numbers.
Events
SerialIsActiveEvent : { IsActive boolean, Type string }
Sent when the serial IsActive state change.
*IsActiveindicates if the serial connection on the specified port is active.
*Typeis"SerialIsActiveEvent".
SerialReceiveEvent : { Lines {}, Data string, Type string }
Sent when data is received from a Serial module.
The module'sReceiveModeproperty determines the type of data received by the event.
* The SerialReceiveMode.BinaryData option passes binary data into theDataproperty.
* The SerialReceiveMode.Lines option splits the received data into lines using the\ncharacter as a separator, writing the result inside theLinesproperty.
*Typeis"SerialReceiveEvent".
Receive modes
There are two valid values for a SerialReceiveMode:
BinaryDataLines
The BinaryData option passes binary data into the event's Data property, the Lines option splits the received data into lines using the \n character as a separator, writing the result inside the event's Lines property.
Parity
SerialParity specifies the parity bit mode:
NoneNo parity check occurs.OddSets the parity bit so that the count of bits set is an odd number.EvenSets the parity bit so that the count of bits set is an even number.MarkLeaves the parity bit set to 1.SpaceLeaves the parity bit set to 0.
Stop bits
SerialStopBits Specifies the number of stop bits.
OneOne stop bit is used.OnePointFive1.5 stop bits are used.TwoTwo stop bits are used.