NAND Gate
A digital logic NAND gate that outputs LOW only when both of its inputs are HIGH.
Component Preview
A fundamental digital logic gate that implements logical NAND (NOT-AND). It produces a LOW output only when all of its inputs are HIGH. If any input is LOW, the output is HIGH.
Logic ComponentsDigital Logic
Overview
The NAND Gate is a universal logic gate (meaning any other logic function can be constructed using only NAND gates). It evaluates to false (LOW) strictly when all input conditions are true (HIGH).
Pin Reference
| Pin | Type | Description |
|---|---|---|
| IN1 | input | First digital logic input. Expects HIGH (1) or LOW (0). |
| IN2 | input | Second digital logic input. Expects HIGH (1) or LOW (0). |
| OUT | digital | Digital logic output. Driven LOW only when both IN1 and IN2 are HIGH. |
Configurable Attributes
This component currently has no configurable attributes.
Working Principle
Truth Table
| IN1 | IN2 | OUT |
|---|---|---|
| 0 (LOW) | 0 (LOW) | 1 (HIGH) |
| 0 (LOW) | 1 (HIGH) | 1 (HIGH) |
| 1 (HIGH) | 0 (LOW) | 1 (HIGH) |
| 1 (HIGH) | 1 (HIGH) | 0 (LOW) |
The NAND Gate physically models the inverted result of Boolean multiplication: Y = (A * B)'.
Wiring Diagram

Example Arduino Code
cpp
const int pinIn1 = 2; // Connect to IN1
const int pinIn2 = 3; // Connect to IN2
const int pinOut = 4; // Connect to OUT
void setup() {
Serial.begin(9600);
pinMode(pinIn1, OUTPUT);
pinMode(pinIn2, OUTPUT);
pinMode(pinOut, INPUT);
Serial.println("NAND Gate Truth Table Test:");
}
void loop() {
for (int state = 0; state < 4; state++) {
bool val1 = (state & 1);
bool val2 = (state & 2) >> 1;
digitalWrite(pinIn1, val1 ? HIGH : LOW);
digitalWrite(pinIn2, val2 ? HIGH : LOW);
delay(10);
int result = digitalRead(pinOut);
Serial.print("IN1: ");
Serial.print(val1);
Serial.print(" | IN2: ");
Serial.print(val2);
Serial.print(" => OUT: ");
Serial.println(result);
delay(1000);
}
}Simulation Notes
- Evaluates logic instantaneously.
- Floating inputs may cause undefined behavior. Tie unused inputs to Ground.
Notes / Warnings
- Voltage Levels: The simulator treats standard logic signals as valid inputs. Do not apply analog voltages.
