Skip to main content

threshold

Syntax

Shorthand:

- threshold: number

Extended:

- threshold:
value: number
direction: above | below
  • value: The numeric threshold. Required.
  • direction: above (default) — emit true when value is greater than or equal to the threshold; below — emit true when value is less than or equal to the threshold.

Description

Converts the output of the previous operation into a digital high (true) or low (false) based on the threshold and direction. With the default above direction, true is emitted when the value is greater than or equal to the threshold, and false when below. With below, true is emitted when the value is less than or equal to the threshold.

If the incoming value is already a boolean (or the strings "true" / "false"), it is passed through as-is without any threshold comparison. If the incoming value is non-numeric and cannot be converted to a number, false is emitted.

In addition to the general purpose expression operations, threshold is the only operation that converts analog inputs into digital outputs.

Examples

  var1:
- source: AIN0
- threshold: 2.5
info

In the above example, AIN0 is an identifier available in LabJack data sources.