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.
*IsActive
indicates if the serial connection on the specified port is active.
*Type
is"SerialIsActiveEvent"
.
SerialReceiveEvent : { Lines {}, Data string, Type string }
Sent when data is received from a Serial module.
The module'sReceiveMode
property determines the type of data received by the event.
* The SerialReceiveMode.BinaryData option passes binary data into theData
property.
* The SerialReceiveMode.Lines option splits the received data into lines using the\n
character as a separator, writing the result inside theLines
property.
*Type
is"SerialReceiveEvent"
.
Receive modes
There are two valid values for a SerialReceiveMode
:
BinaryData
Lines
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:
None
No parity check occurs.Odd
Sets the parity bit so that the count of bits set is an odd number.Even
Sets the parity bit so that the count of bits set is an even number.Mark
Leaves the parity bit set to 1.Space
Leaves the parity bit set to 0.
Stop bits
SerialStopBits
Specifies the number of stop bits.
One
One stop bit is used.OnePointFive
1.5 stop bits are used.Two
Two stop bits are used.