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
  • task
  • task pass
  • is event
  • pop event
  • push event
  1. Platform
  2. Sandbox
  3. Visual Editor

Special

PreviousVisual EditorNextLogic

Last updated 2 months ago

Special blocks provide essential control over program execution and event handling in your IoT system. These blocks enable you to:

  • Control program timing and execution

  • Handle MQTT events

  • Manage program state

  • Create event-driven behaviors

task

Creates a recurring task that executes at specified intervals. This is the primary execution loop required in every script - only one task block is allowed per script as it serves as the main program loop.

Parameters:

  • Iterations (Number): How many times to run (0 for infinite)

  • Interval (Number): Time between executions in milliseconds

Example:

task pass

Returns the current task iteration count. For infinite tasks (0 iterations), returns -1.

Returns:

  • Number (Number): -1 if infinite; otherwise a countdown from n-1 to 0

An iterator can not be used outside the task block.

Example:

A custom iterator implementation.

is event

Checks if a specific MQTT event exists in the queue.

Parameters:

  • Event Name (String): Name of the event to check

Returns:

  • Boolean: #t if event exists, () if not

This block will return true until you retrieve and remove the value using the pop event block.

Example:

pop event

Retrieves and removes the oldest event of the specified type from the queue.

Parameters:

  • Event Name (String): Name of the event to retrieve

Returns:

  • Value: The event value, or () if no event exists

The event payload is always of type Number.

Example:

push event

Sends an event with a value to the MQTT broker.

Parameters:

  • Event Name (String): Name of the event

  • Value: Value to send (number or boolean)

The event payload is always of type Number. Boolean values are converted to 1 or 0.

Example:

Read temperature every 5 seconds and send an event with the value
Create LED patterns based on iteration
Check and retrieve an event
Check and retrieve an event
Send sensor readings