Skip to main content

wokwi-slide-switch Reference

Standard Single Pole Double Throw (SPDT) slide switch.

Pin names#

NameDescription
1Left terminal
2Common terminal
3Right terminal

The slide switch has three pins. Pin 2 (in the middle) is the common pin. Depending on the position of the switch's handle, it's connected to either pin 1 or 3:

Handle positionDescription
LeftShorting pins 1 and 2
RightShorting pins 3 and 2

The following diagram illustrates the connections inside the slide switch. You can see the gray sliding contact that moves together with the handle and creates a connection between pin 2 and either pin 1 or 3:

Slide switch connection diagram

Attributes#

NameDescriptionDefault value
valueInitial position of the slide switch:
"" for left, "1" for right
""
bounceSet to "0" to disable bouncing""

Bouncing#

When you move a physical slide switch, the circuit opens and closes tens or hundreds of times. This phenomenon is called Bouncing.

Wokwi simulates switch bouncing by default. You can disable the bouncing simulation for individual switches by setting their "bounce" attr to "0":

{ "bounce": "0" }

Simulator examples#