Jump to content

Component: SerialPort ( Comms): Difference between revisions

From Flowcode Help
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(5 intermediate revisions by the same user not shown)
Line 30: Line 30:


===Close===
===Close===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Close'''
| width="90%" class="mtx-class-macrohead" | '''Close'''
|-
|-
| colspan="2" | Closes the serial port 
| colspan="2" | Closes the serial port 
Line 44: Line 44:


===GetProductId===
===GetProductId===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetProductId'''
| width="90%" class="mtx-class-macrohead" | '''GetProductId'''
|-
|-
| colspan="2" | Returns the productId of the selected USB COM port 
| colspan="2" | Returns the productId of the selected USB COM port 
Line 58: Line 58:


===GetVendorId===
===GetVendorId===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetVendorId'''
| width="90%" class="mtx-class-macrohead" | '''GetVendorId'''
|-
|-
| colspan="2" | Returns the vendortId of the selected USB COM port 
| colspan="2" | Returns the vendortId of the selected USB COM port 
Line 72: Line 72:


===Open===
===Open===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Open'''
| width="90%" class="mtx-class-macrohead" | '''Open'''
|-
|-
| colspan="2" | Attempts to open a serial port that has already been selected using RequestPort  Returns true if port is successfully opened 
| colspan="2" | Attempts to open a serial port that has already been selected using RequestPort  Returns true if port is successfully opened 
Line 86: Line 86:


===ReceiveString===
===ReceiveString===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveString'''
| width="90%" class="mtx-class-macrohead" | '''ReceiveString'''
|-
|-
| colspan="2" | Receives a string from the serial port 
| colspan="2" | Receives a string from the serial port 
Line 110: Line 110:


===RequestPort===
===RequestPort===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RequestPort'''
| width="90%" class="mtx-class-macrohead" | '''RequestPort'''
|-
|-
| colspan="2" | Asks the user which serial port to use.  Returns the selected COM port as a hex string in  the form 0xVVVVPPPP where VVVV and PPPP are the vendorID and productID of the USB device. 
| colspan="2" | Asks the user which serial port to use.  Returns the selected COM port as a hex string in  the form 0xVVVVPPPP where VVVV and PPPP are the vendorID and productID of the USB device. 
Line 124: Line 124:


===SendString===
===SendString===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
| width="90%" class="mtx-class-macrohead" | '''SendString'''
|-
|-
| colspan="2" | Sends a text string through an open serial port 
| colspan="2" | Sends a text string through an open serial port 
Line 144: Line 144:
==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Comms Settings
| width="90%" class="mtx-class-propfolder" | Comms Settings
|-
|-
|-
|-

Latest revision as of 14:37, 13 July 2026

Author MatrixTSL
Version 0.1
Category Comms


SerialPort component

Allows connection to a serial port e.g. a standard serial COM port from the browser.

Detailed description

No detailed description exists yet for this component

Examples

Simple Data

Example program showing how to use communicate to a standard serial COM port.

Web Serial Port Example

Macro reference

Close

Close
Closes the serial port 
- VOID Return


GetProductId

GetProductId
Returns the productId of the selected USB COM port 
- LONG Return


GetVendorId

GetVendorId
Returns the vendortId of the selected USB COM port 
- LONG Return


Open

Open
Attempts to open a serial port that has already been selected using RequestPort Returns true if port is successfully opened 
- BOOL Return


ReceiveString

ReceiveString
Receives a string from the serial port 
- LONG Timeout
Time (in ms) to wait for data 
- LONG NumChars
Number of characters to try to receive 
- STRING Return


RequestPort

RequestPort
Asks the user which serial port to use. Returns the selected COM port as a hex string in the form 0xVVVVPPPP where VVVV and PPPP are the vendorID and productID of the USB device. 
- STRING Return


SendString

SendString
Sends a text string through an open serial port 
- STRING sText
 
- VOID Return


Property reference

Properties
Comms Settings
Baud Rate
The baud rate for the serial communication 
Custom Baud
A custom baud rate that is not limited to those in the drop-down list (must be a positive integer greater than 0) 
Data Bits
Data bits per frame (default = 8) 
Stop Bits
Number of stop bits at the end of a frame (default = 1) 
Parity
The parity mode for serial communication (default = none) 
Buffer Size
Size of the read and write buffers used (default = 255) (must be an integer greater than 0)  
Flow Control
The flow control mode for communication (default = none) 
Filters
Limits the list of available COM ports to specific USB devices, for example: { usbVendorId: 0x2A03, usbProductId: 0x0043 }, { usbVendorId: 0x2341, usbProductId: 0x0043 }, { usbVendorId: 0x2341, usbProductId: 0x0001 } (leave blank for all COM ports)  

Component Source Code

Please click here to download the component source project: FC_Comp_Source_WEBEXP_SerialPort.fcsx

Please click here to view the component source code (Beta): FC_Comp_Source_WEBEXP_SerialPort.fcsx