const
Description
The const block stores one constant value and sends it to its output when it is triggered by an input event or by the set command from the command block. It also supports the reset command from the command block, which causes the block to send the null value.
The block has one input and one output. It does not require the use of inputs labeled with the tag block.
The constant value may have one of the following types:
- boolean
- numeric
- text
If no other source is connected to the block input, then after the project starts the block sends the configured value once on its own.
Configuration parameters
| Parameter name | Value |
|---|---|
Triggering edge (input_edge) |
Required parameter that defines which ordinary input event should cause the constant value to be sent again. Supported values are: rising, falling, both, true, false, null, none. |
Value type (value_type) |
Required parameter that defines the type of the constant value. Supported values are: bool, num, str. |
Value (value) |
Required parameter that defines the constant value sent to the output. Its interpretation depends on value_type. |
Meaning of the input_edge parameter:
rising: react to a change interpreted asfalse -> truefalling: react to a change interpreted astrue -> falseboth: react to every change between logical statestrue: react to every input event whose new value can be interpreted as logical truefalse: react to every input event whose new value can be interpreted as logical falsenull: react to every input event whose new value isnullnone: do not react to ordinary input events
Meaning of the value_type parameter:
bool: the block stores the logical valuetrueorfalsenum: the block stores a numeric value; integers, floating-point numbers, temperature, and percent are allowedstr: the block stores a text value
Input handling
The block reacts to ordinary events delivered to its only input and to the set and reset commands sent from the command block.
The block does not require any tag inputs.
Detailed operating rules:
- if no other block is connected to the input,
constsends the configured value by itself after initialization is finished - an ordinary input event that matches the
input_edgecondition causes the configured value to be sent again - for
input_edge = none, all ordinary input events are ignored - the
setcommand from thecommandblock causes the configured value to be sent again regardless of theinput_edgesetting - the
resetcommand from thecommandblock causes the block to send thenullvalue of the same type as the configured value - after the
resetcommand, the nextsetcommand or the next valid input trigger sends the configured value again
Additional input interpretation rules:
- for
rising,falling, andboth, the block requires values that can be interpreted logically - for
trueandfalse, the block reacts to every input event whose new value is interpreted respectively as true or false, even if the previous value was the same - for
null, the block reacts only to input events whose new value isnull
Block outputs
The block has one output.
The output always carries the value configured in the block parameters, unless the block receives the reset command, which sends the null value.
The way the value is emitted depends on the configured type:
- for
value_type = str, every emission has the formnull -> text - for
value_type = num, every emission has the formnull -> number - for
value_type = bool, every emission has the form of a change from the opposite logical state to the configured value, that isfalse -> trueortrue -> false
The description visible below the block shows the value currently prepared to be sent in text form, for example:
truefalse2521.5°Chello
After the reset command, the block description changes to null. After the configured value is sent again, the description returns to its text representation.
Errors returned by the block
The block can show the following error messages:
| Error code | Error description |
|---|---|
Invalid input edge configuration. |
The input_edge parameter is invalid or was not set. |
Missing value type configuration. |
The value_type parameter is missing in the configuration. |
Invalid value type configuration. |
The value_type parameter has a value outside the supported list: bool, num, str. |
Missing value configuration. |
The value parameter is missing in the configuration. |
Invalid value configuration. |
The value parameter has an invalid form for the selected value type. This includes, among others, the case when bool is given a value other than true or false, or when a valid numeric value cannot be read for num. |
Expected numeric value configuration. |
The value_type parameter is set to num, but the value parameter does not contain a numeric value. |
Set description failed. |
The block cannot prepare a text description of the configured value. This is an internal error and means the value cannot be displayed correctly in the block description. |
Usage examples
- If
value_type = str,value = hello, and no other block is connected to the input, then after the project startsconstsends the valuehelloto the output by itself. - If
value_type = num,value = 21.5°C, andinput_edge = rising, then every rising edge on the input causes the value21.5°Cto be sent to the output. - If
value_type = boolandvalue = true, then thesetcommand from thecommandblock causes the changefalse -> trueto be sent, regardless of theinput_edgesetting. - If
value_type = boolandvalue = false, then every valid trigger causes the changetrue -> false. - If the block receives the
resetcommand,nullappears at the output and the block description changes tonull.