toggle
Syntax
Shorthand syntax
- toggle
Extended syntax
- toggle:
default: boolean
reset: expression
Description
The toggle operation alternates the output state between true and false each time a new high signal is received. This could for example be used to simulate a latching push-button switch when a momentary switch is being used as the input.
There are two optional parameters that can be specified. The default parameter specifies the initial state of the toggle output, and should be set as either true or false. If not specified, the value is false.
The second parameter is reset, which is an expression that is run when the toggle input changes or if any of the dependent values within the expression change. When the expression evaluates to true, the output state of the toggle is set back to its default value.
Examples
- AdapterScript
var1:
- source: AIN0
- threshold: 4
- debounce: 0.1
- toggle
In the above example, AIN0
is an identifier available in LabJack data sources.