Uniot Docs
  • Introduction
  • Guides
    • Getting Started
    • Uniot Badge
    • Device Network
  • Foundations
    • Edge Logic Deployment
  • General Concepts
    • Primitives
    • Scripting
  • Platform
    • Dashboard
    • Sandbox
      • Visual Editor
        • Special
        • Logic
        • Math
        • Loops
        • Text
        • Variables
        • Functions
        • Primitives
      • Logger
      • Emulator
      • Control Panel
  • Advanced
    • Uniot Core
      • Scheduler
        • TaskScheduler
        • IExecutor
        • ISchedulerConnectionKit
        • Task
        • SchedulerTask
      • AppKit
        • AppKit
        • LispDevice
        • LispPrimitives
        • TopDevice
      • CBORWrapper
        • CBORObject
        • COSE
        • COSEMessage
        • ICOSESigner
      • Date
        • Date
        • SimpleNTP
      • EventBus
        • EventBus
        • IEventBusConnectionKit
        • DataChannels
        • EventEmitter
        • EventListener
        • EventEntity
        • CallbackEventListener
      • Hardware
        • Button
      • LispWrapper
        • DefaultPrimitives
        • LispHelper
        • PrimitiveExpeditor
        • unLisp
      • MQTTWrapper
        • CallbackMQTTDevice
        • MQTTDevice
        • MQTTKit
        • MQTTPath
      • Network
        • ConfigCaptivePortal
        • NetworkController
        • NetworkScheduler
      • Register
        • GpioRegister
        • ObjectRegister
        • ObjectRegisterRecord
        • Register
        • RegisterManager
        • RegisterManagerProxy
      • Storage
        • CBORStorage
        • CrashStorage
        • Storage
        • WifiStorage
      • Utils
        • Array
        • Bytes
        • ClearQueue
        • IterableQueue
        • LimitedQueue
        • GlobalBufferMemoryManager
        • Map
        • Singleton
        • TypeId
      • Credentials
    • Uniot Lisp
      • Language Description
      • Embedding Instructions
  • API
    • MQTT Convention
Powered by GitBook
On this page
  • value
  • if
  • Block Modification
  • comparison
  • and
  • or
  • not
  1. Platform
  2. Sandbox
  3. Visual Editor

Logic

PreviousSpecialNextMath

Last updated 2 months ago

Logic blocks help you make decisions in your scripts based on conditions. Use logic to:

  • Compare values

  • Create conditional behaviors

  • Combine multiple conditions

  • Control program flow based on states

value

Represents a boolean value (#t for true or () for false).

Parameters:

  • Value (Boolean): Boolean value to set.

Returns:

  • Boolean: The selected Boolean value.

Example:

if

Executes enclosed blocks if the condition is true.

Parameters:

  • Condition (Boolean): The condition to check

Example:

Block Modification

Only the plain if block appears in the toolbox. To add else if and else clauses, click on the gear icon, which opens a new window:

You can drag else if and else clauses under the if block, reorder them, and remove them as needed. When finished, click on the gear icon to close the window, as shown here:

Note that the shape of the blocks allows any number of else if subblocks to be added but only up to one else block.

comparison

Compares two values using operators: =, ≠, <, >, ≤, ≥

Parameters:

  • Left Value (Number or comparable type): The first value to compare.

  • Right Value (Number or comparable type): The second value to compare.

  • Operator (Enum): The operator to use for the comparison.

Returns:

  • Boolean: true if the comparison is satisfied, otherwise false.

Example:

and

Returns true only if all conditions are true.

Parameters:

  • Input A (Boolean): The first condition to check.

  • Input B (Boolean): The second condition to check.

Returns:

  • Boolean: true if both inputs are true, otherwise false.

Example:

or

Returns true if any condition is true.

Parameters:

  • Input A (Boolean): The first condition to check.

  • Input B (Boolean): The second condition to check.

Returns:

  • Boolean: true if at least one input is true, otherwise false.

Example:

not

Inverts a boolean value. If no input is provided, a value of true is assumed. Leaving an input empty is not recommended, however.

Parameters:

  • Input (Boolean): The boolean value to invert.

Returns:

  • Boolean: The inverted boolean value.

Example:

Set initial values
Send event if button was clicked
Check humidity and send event when it is too high
Multiple condition check
Humidity alert
Toggle state by button click