Digital inputs and outputs
Show input/Output
The function getInput(inputName)/getOutput(outputName) is required to read out the value of an input/output. The function requires 1 parameter as a string. The string must describe an input/output, e.g. "INPUT_1","OUTPUT_4".
The function then returns a 0 or 1, depending on the current value of the input.
getInput("INPUT_1");
or
getOutput("OUTPUT_4");
Set or switch output
To switch an output, the setOutput command must be entered in the CodeArea.
The first parameter specifies which output is to be switched. Possible correct values are "OUTPUT_1" to "OUTPUT_14", as well as "TOOL_OUTPUT_1" and "TOOL_OUTPUT_2" for the UserIO.
The second parameter specifies the value of the corresponding output. Permissible values are 1 or 0
setOutput("OUTPUT_1", 1);
Register
Various registers are available in horstFX:
- 64 Int Register
- 64 Float Register
- 128 Bool Register
Set register
The function
is required to write a value to a position in the register.
Read register
The function
is required to read a value from the corresponding register.
horstCOSMOS
Process data can be saved using the recordData(key, value, category) method. The key is a character string with which the data can be identified again later. The value to be saved is specified under value. This can be a character string or a number. Optionally, a character string can be specified as the third parameter as a category.
Data saved via recordData() is automatically synchronised daily with horstCOSMOS, our IOT platform. If this synchronisation is to take place immediately, this can be achieved using the sendRecordedData() function.
Example
recordData("data 1", 2.34, "pressure");
sendRecordedData();