Source: https://mokxi.com/parts/slideswitch
Updated: 2026-11-10

Part

# Slide switch

Two positions, held where you leave it.

See every part

- 3 pins
- In 34 projects
- In 28 lessons

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Slide switch in brief

What it is, and where it sits on the bench.

A slide switch is the small three-legged SPDT switch in most kits: sliding the knob joins the middle leg, the common pole, to one outer leg or the other. Mokxi’s part does exactly that, with pin 2 tied through a 50 milliohm contact to pin 1 or pin 3 and the unselected throw left genuinely open, so anything hanging off it floats the way it would on a breadboard. No pin is an input or an output: the contact passes whatever is on either side in either direction, so it works as a logic-level input or a supply selector. To read it from an Arduino Uno or ESP32, wire pin 2 to a GPIO and the outer legs to ground and to the supply, using 3.3 volts on an ESP32, never 5. The common mistake is wiring only one throw and expecting the other position to read as a clean 0 or 1, when that pin is floating unless a pull resistor holds it. There is no contact bounce and no travel time between the throws.

Family

Inputs

Pins

3

Pins

## 3 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

What it does

1

One throw.

2

The common pole.

3

The other throw.

How to use it

## How to use a slide switch with an Arduino

The middle leg goes to a digital pin and one outer leg to GND. Set the pin to INPUT_PULLUP in setup(), and digitalRead() gives LOW with the slider on the grounded side and HIGH with it on the other, where the pin is held up only by the pull-up. That is how the elevon mixer here picks between its two modes on pin 4, with the third leg left unwired.

Leave out INPUT_PULLUP and the unwired position reads Floating instead of HIGH, because nothing drives the pin at all. Wiring the third leg to 5 V instead gives a driven HIGH in both positions and needs no pull-up at all. Either way, read the switch in loop() rather than once in setup(), so flipping it while the sketch runs changes the mode.

Part pin

Board pin

2 (the common pole)

Pin 4

1

GND

3

Not connected

The same wiring works on an ESP32 or a Pico; if you wire the third leg to a supply there, use 3.3 V, never 5 V.

Hold the button

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

Reading the mode switch, from the elevon mixer

How it is modeled

## What is true about the Slide switch, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

No pin is treated as an "input": a slide switch passes whatever is on one side
through to the other, in either direction, which is what makes it just as useful as
a supply selector as it is as a logic-level input.

### Not modeled

No contact bounce. A real slide switch chatters for a millisecond or so on the way
across, but nothing in the firmware library needs it modeled, and a silent
approximation beats a wrong one. The pushbutton is where
bounce is modeled, because a debounce lesson actually needs it there. Nor is there any
travel time: the pole leaves one throw and arrives at the other in the same instant,
where a real slider is genuinely open for a moment in between. There is no contact
resistance drift, no wear and no current rating.

From Slide switch (SPDT), in full.

Projects

## See the Slide switch in a project

34 built-in projects use it. Each opens in the editor, already wired.

Lessons

## Where it turns up in a lesson

28 lessons place it in their own circuits.

### The twelve week course

3 lessons

- Week 1: Current, voltage and the breadboard
- Week 4: Timing without a processor: the 555
- Week 6: Arithmetic from gates: the full adder

### Learn articles

25 lessons

- Ohm's Law, in a Circuit You Can Run
- Shifting a Byte In, One Edge at a Time
- Blink an LED with a 555 Timer, No Microcontroller
- Diodes for Reverse Polarity Protection
- NPN Transistor as a Switch: a 2N2222 and an Arduino
- The Flyback Diode, and the Spike It Stops
- MOSFET vs BJT: Which Transistor to Switch With
- Digital Electronics on Chromebooks: Labs by Unit
- Half Adder and Full Adder: Truth Table to Breadboard
- Flip-Flops Explained: SR Latch, D and JK Flip-Flops
- Circuit Lab Division B: Middle School Starter Guide
- TSA Electrical Applications: Practice Circuits
- Arduino MOSFET Module: Why the IRF520 Is Half On
- Leverless Controller Build: Buttons, Pins and Code
- SOCD Cleaning Explained, With Code
- Design Your Sim Racing Button Box in the Browser
- 3D Printer Firmware: Homing, PID, G-code, Runout
- DIY Stream Deck and Camera Slider With Arduino
- Arduino Eurorack CV Quantizer With a PWM DAC
- A4988 Pinout: Pins, Microstep Table and Vref
- Arduino DRV8825: Wiring, Code and Microstepping
- Virtual Electronics Lab for College Classes
- Run an Electronics Lab for Online Classes
- NPN Transistor Switch Simulator
- 555 Timer Simulator: an LED Blinker

Boards

## The boards it is shown on

Each of these 3 boards has a built-in project with the Slide switch in it.

- Arduino Uno R3
- SparkFun Pro Micro
- Arduino Nano

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Slide switch

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
