Parts

2-to-1 multiplexer (ideal)

A two-way switch for logic signals, with no chip behind it: SEL picks whether Y copies A or B. It needs no power.

It is a teaching part, the companion to the ideal gate and the ideal inverter, and it sits with them in the part panel under Logic. A Wokwi project's wokwi-mux-2 imports as this part, with Wokwi's OUT pin mapped to Y.

Pins

Pin What it does
A The input Y follows while SEL is low.
B The input Y follows while SEL is high.
SEL The select input: low picks A, high picks B.
Y The chosen input, driven strongly high or low.

Truth table

SEL A B Y
0 0 any 0
0 1 any 1
1 any 0 0
1 any 1 1

In one line: Y = SEL ? B : A.

Properties

None. There is nothing to set: the part has no supply, no enable and no width.

What you can build with one

Switch between two signals. Put a fast clock on A and a slow one on B, and SEL chooses which one an LED or a counter sees. This is what Flip-flop lab does: button C moves SEL, and the blue LED shows one flip-flop's output or the other's.

Any two-input gate. A multiplexer with a constant on one input is a gate. Tie an input to GND (0) or to a VCC symbol (1) and put the signals on the rest:

Wire it like this and Y is
A = 0, B = x, SEL = y x AND y
A = x, B = 1, SEL = y x OR y
A = 1, B = 0, SEL = x NOT x
A = x, B = NOT x, SEL = y x XOR y

That is why a multiplexer is the building block inside an FPGA's lookup tables: it can be any function of its select inputs.

Let a board choose. An Arduino pin on SEL picks between two signals the board does not have to generate itself. This sketch flips the choice every second:

const int SEL_PIN = 7;  // wired to the multiplexer's SEL

void setup() {
  pinMode(SEL_PIN, OUTPUT);
}

void loop() {
  digitalWrite(SEL_PIN, LOW);   // Y follows A
  delay(1000);
  digitalWrite(SEL_PIN, HIGH);  // Y follows B
  delay(1000);
}

Wire the board's GND to the same ground as anything driving A and B.

What the model gets right

Unknown inputs only matter when they could change the answer. The input SEL does not pick does not matter, so B can float while SEL is low. When A and B agree, SEL does not matter either, so Y is defined even with SEL floating. Otherwise a floating input makes Y unknown, which the canvas shows.

A change takes 10 ns to reach Y, and the delay is inertial: a pulse on any input shorter than 10 ns never gets through, as on the ideal gate.

What it does not model

  • No supply pins. Y is driven from nowhere, so the part works with nothing wired to power, and it can never be unpowered.
  • A flat 10 ns delay that comes from no datasheet, the same for every path. A real multiplexer's select-to-output and data-to-output delays differ.
  • No enable input and no glitch. A real mux can glitch for a few nanoseconds when SEL changes while A and B are both high; this one holds Y steady.
  • No load, no fan-out limit, no output current.

Common mistakes

Swapping A and B. SEL low picks A, the input on top in most textbooks.

Leaving SEL floating. Unless A and B agree, Y is unknown. Tie SEL to a switch with a pull-down, a slide switch or a board pin.

Expecting it to pass analog voltages. It is a logic part: Y is a clean high or low, whatever voltage is on the chosen input. For a switch that passes an analog signal, see analog switches.