# Creating a Delayed Operation Switch

If the Switch is pressed continuously for a set time (for example, 3 seconds), the specified bit will turn ON. This is useful in preventing accidental input.

If you take your finger off the switch before it gets enabled, the Switch action will be disabled.

## Example Operation

## Setting Workflow

1. Add Variables
2. Set up Parts
3. Set up Scripts

## Add Variables

### Project Explorer : [Variables] ➞ [All Variables]

Add the below variable(s).

#### Variables property:

[Name] | [Data Type]
Var1 | [BOOL]

## Set up Parts

### Project Explorer : [Screen Design] ➞ [Screens] ➞ [Screen1]

Drag and drop the following objects from the [Tool Chest] to the screen.

#### Switch object (Name: Switch1) properties:

Default value

## Set up Scripts

### Project Explorer : [Screen Design] ➞ [Screens] ➞ [Screen1]

Set the following script on the object.

From the [Tool Chest] drag and drop the script to the Script editor.

#### Switch object (Name: Switch1) script:

Legend | Block
1 | [Triggers] ➞ [Touch] ➞ [Touch]
2 | [Operations] ➞ [Value Change] ➞ [Bool Value Change]
3 | [Values] ➞ [Variable]
4 | [Values] ➞ [Screen Object]