Skip to content

TCP Send and Receive Characters

Project Flow

1. Device Configuration

Select the TCP server, set the host address and port, and click the enable button.

2. TCP Send and Receive Characters

  1. Select the Lua Script tool, and set global variables for sending and global variables for judgment.
lua
-- Set global variables for return
SetStringVariable("Return1", "Result is correct")
SetStringVariable("Return2", "Result is incorrect")
SetStringVariable("Return3", "There is a slight problem with the result")
-- Set global variables for judgment
SetFloatVariable("judge", 10.000)
  1. Select the Receive String tool, choose the device, and set the timeout period and output.

  2. Select the Lua Language Script tool, write a script and ensure the script runs with OK result.

lua
-- An OK script
println('Hello AI-Vision!')
  1. Select the Send String tool, set the activation binding to the Result variable of the previous Lua script, and set the content to be sent as the Return1 global variable.

  2. Select the Lua Language Script tool, edit the script to set the running result as NG.

  3. Select the Send String tool, set the activation binding to the Result variable of the previous Lua script, enable inverted activation, and set the content to be sent as the Return2 global variable.

  4. Select the Judgment tool and manually set a WARN.

  5. Select the Send String tool, set the activation binding to the Warning variable of the previous judgment tool, and set the content to be sent as the Return3 global variable.

AI-Vision, Making 3D Measurement Easier