Widgets/Logic

First Event Widget

First Event Widget

A "Logic" type widget. First Event Widget allows the first event to pass through and then suspends execution for a specified duration. It's particularly useful for implementing debouncing, handling initial triggers, or creating time-based patterns in your workflow.

 

Inputs

  • input1 to input20 (DataType: Anything) Multiple input ports that can receive events. The number of ports is configurable (up to 20 inputs). When an event arrives at any input, it triggers the widget's behavior.

  • reset (DataType: Anything) Resets the internal timer, allowing the next event to pass through immediately regardless of the remaining delay time.


Outputs

  • output1 to output20 (DataType: Same as input) When matching outputs is enabled, each input has a corresponding output port. Events from input1 go to output1, input2 to output2, and so on.

  • output (DataType: Same as input) When matching outputs is disabled, all passed events go through this single output port.

  • aborted (DataType: Same as input) Events that arrive during the delay period are sent to this port instead of being passed through.


Custom Settings

  • Input/Output Configuration — Configure the number of input ports (1-20)

  • Match Outputs — When enabled, each input has a corresponding output port (input1 → output1, input2 → output2, etc.). When disabled, all passed events go through the single output port.

  • Delay Duration — Set how long to suspend events after the first event passes through. The delay is specified in milliseconds. Setting it to 0 disables the delay.


Configuration

 

📌 Important Notes

  • The delay timer starts when the first event successfully passes through
  • Setting delay to 0 disables the delay, allowing all events to pass through
  • The reset input can be triggered at any time to allow the next event through
  • When matching outputs is enabled, each input's events only go to its corresponding output

 

Examples

Basic Debouncing

This example shows how to use the First Event Widget to implement basic debouncing


Drag the example onto the workspace to explore and experiment!



In this example:

  1. The Clock widget generates events every 100ms continuously
  2. The First Event widget is configured with 1 input, matching outputs enabled, and a 1000ms delay
  3. When the first event arrives, it passes through to the output1 port immediately
  4. The internal delay timer starts, blocking all subsequent events for the next 1000ms
  5. Events that arrive during the delay period are redirected to the aborted port
  6. The first Counter widget tracks successful events that passed through
  7. The second Counter widget tracks events that were blocked during the delay period
  8. Result: Demonstrates classic debouncing behavior where only the first event passes through, and all subsequent events within the delay window are blocked

 

Multiple Input Handling

This example demonstrates using multiple inputs with matching outputs


Drag the example onto the workspace to explore and experiment!



In this example:

  1. Two Clock widgets generate events at different intervals (100ms and 235ms)
  2. The Button widget starts both clocks simultaneously
  3. The First Event widget is configured with 2 inputs, matching outputs enabled, and a 1000ms delay
  4. When the first event arrives from either input, it passes through to its corresponding output (input1output1, input2output2)
  5. Subsequent events from the same input are blocked during the 1000ms delay period
  6. Counter widgets track which input's events successfully passed through
  7. Result: Only the first event from each input port passes through, demonstrating independent debouncing per input channel

 

📌 Additional Notes

  • The widget preserves the data type of the input when passing it to the output
  • The widget maintains its timer state until explicitly reset or the recipe is reloaded

 

Glossary

  • Debouncing

    Technique for limiting the frequency of function execution, preventing multiple rapid activations. Useful for handling user input or sensor data that may trigger multiple times in quick succession.

  • Initial Triggers

    The first event that activates a process before a waiting period is established. This widget allows the initial trigger to pass through immediately while blocking subsequent events during the delay period.