Math

Math blocks provide numerical operations and calculations for your scripts. Use these blocks to perform arithmetic, apply mathematical functions, and manipulate numeric values from sensors or variables.

value

A numeric constant. Use this block to provide fixed numbers for calculations, comparisons, or as parameters to other blocks.

Parameters:

  • Value (Number): Enter any numeric value (integers or decimals)

Example:

Define temperature thresholds

math operation

Applies a single-value mathematical operation. Choose from absolute value (removes sign) or negation (flips positive to negative and vice versa).

Parameters:

  • Operation: Select abs (absolute value) or - (negate)

  • Value (Number): The number to operate on

Returns:

  • Number: The result of the operation

Example:

Temperature difference calculation

arithmetic

Performs basic arithmetic operations between two numbers.

Parameters:

  • Left Value (Number): The first number

  • Operator: Choose + (add), - (subtract), × (multiply), ÷ (divide), ^ (power)

  • Right Value (Number): The second number

Returns:

  • Number: The result of the calculation

Example:

Convert raw sensor value to voltage

number condition

Checks whether a number meets a specific condition. Use this for pattern detection or periodic actions.

Parameters:

  • Value (Number): The number to check

  • Condition: Select even, odd, positive, negative, whole, divisible by

Returns:

  • Boolean: #t (true) if the condition is met, () (false) otherwise

Example:

Read sensor value every 5th script execution

remainder

Calculates the remainder after dividing one number by another (modulo operation). Useful for creating repeating patterns or detecting multiples.

Parameters:

  • Dividend (Number): The number to be divided

  • Divisor (Number): The number to divide by

Returns:

  • Number: The remainder of the division

Example:

Alternate on/off pattern for multiple LEDs

Last updated