This electronics project shows how to assemble a simple transistor NAND gate on a solderless breadboard. Normally open pushbuttons are used for the two inputs. The LED will be on until you press both of the pushbuttons. This action causes both inputs to go HIGH, which causes the output to go LOW and the LED to go dark.
A two-input NAND gate produces a LOW output if both of its inputs are HIGH. It’s easy enough to create a NAND gate by using just two transistors.
A NAND gate circuit is almost identical to an AND gate circuit. The only difference is that instead of connecting the output to the emitter of the second transistor, the output is obtained before the collector of the first transistor.
If both of the inputs are HIGH, both of the transistors will conduct through their collector-emitter paths, which creates a short circuit to ground. This causes the current to bypass the output altogether, which in turn causes the output to go LOW.
If either transistor turns off, however, the supply current can’t flow through the transistors to ground, so it flows through the output circuit instead. Thus, the output is HIGH if either one of the inputs is LOW. If both inputs are HIGH, the output is LOW.