Switches & Buttons
A switch is a mechanical contact that opens or closes a connection. de:volt ships three: the Switch (SPST) switch-spst, a latching on/off toggle; the Push Button switch-push, a momentary contact that closes only while held; and the SPDT Switch switch-spdt, a selector that routes a common terminal to one of two outputs. For a bank of switches in a single package, see the DIP switch on Arrays & Switches.
Actuating a switch
Every switch in de:volt is toggled by clicking it on the canvas while the simulation runs. A latching switch flips state and stays there; a momentary push button closes while you hold the click and re-opens when you release. You do not wire a separate signal to drive them — the click is the actuation.
Switch (SPST) — switch-spst
Single-pole single-throw: one contact pair that is either open or closed. It latches — once you flip it, it stays in that position until you flip it again — which makes it the right part for a power switch or a mode select that should hold its setting.
Pinout
| Pin | Label | Function |
|---|---|---|
| a | A | Left terminal, top leg |
| a2 | A2 | Left terminal, bottom leg; internally common with a |
| b | B | Right terminal, top leg |
| b2 | B2 | Right terminal, bottom leg; internally common with b |
On the breadboard footprint, the corners are top-left a, top-right b,
bottom-left a2, and bottom-right b2. Pressing the button connects the left
terminal (a/a2) to the right terminal (b/b2).
Parameters
| Parameter | Default | Meaning |
|---|---|---|
closed | 0 | 0 = open, 1 = closed |
momentary | 0 | 0 = latching (stays put), 1 = momentary |
Both are boolean and editable in the Inspector, so you can drop the switch in already closed, or turn it momentary if you want push-button behaviour from the SPST body.
Push Button — switch-push
A momentary tactile button: the contact closes while held and opens the moment you release. This is the standard way to give a microcontroller a manual input.
Pinout
| Pin | Label | Function |
|---|---|---|
| a | A | Terminal (non-polar) |
| b | B | Terminal (non-polar) |
Parameters
| Parameter | Default | Meaning |
|---|---|---|
closed | 0 | 0 = released, 1 = pressed |
momentary | 1 | 1 = momentary (the button default) |
The pull-up / pull-down pattern
A bare button connects nothing to a digital input when it is open, leaving the pin floating — an undriven input that reads random noise. You fix that with a resistor that pins the input to a known level until the button overrides it. Two arrangements:
- Pull-up (most common): a 10 kΩ resistor from VCC to the input pin, with the button between the input pin and GND. At rest the resistor holds the input HIGH; pressing the button shorts it to GND so the input reads LOW. Note the inversion: pressed = LOW.
- Pull-down: a 10 kΩ resistor from the input pin to GND, with the button between VCC and the input pin. At rest the input is held LOW; pressing it reads HIGH.
The pull-up version is the classic layout:
VCC ─── 10kΩ ──┬─── MCU input pin
│
[button]
│
GNDOn real hardware the metal contacts bounce for a millisecond or two as they make and break, producing a burst of fast transitions. A 100 nF debounce capacitor from the input pin to GND smooths that edge; in software you can instead wait a few milliseconds and re-read. Add the cap if your sketch is miscounting presses.
SPDT Switch — switch-spdt
Single-pole double-throw: one common terminal that is always connected to exactly one of two outputs, never both, never neither. It is the part for A/B signal routing or a two-way mode select.
Pinout
| Pin | Label | Function |
|---|---|---|
| com | COM | Common (the pole) |
| b | B | Throw B |
| c | C | Throw C |
Parameters
| Parameter | Default | Meaning |
|---|---|---|
position | 0 | 0 routes COM↔B; 1 routes COM↔C |
The position parameter selects which throw is live and is editable in the Inspector; clicking the switch on the canvas flips it between the two throws. Because COM is always tied to one side, an SPDT makes a clean break-before-make selector — no moment where both outputs are joined.
Related parts
- Arrays & Switches — the multi-position DIP switch for setting several bits at once.
- LEDs — a button plus an LED is the canonical first interactive circuit.
New to placing and wiring parts? Start with Getting started.