Skip to content

OR Gate

A fundamental digital logic gate that outputs HIGH when at least one of its inputs is HIGH.

Component Preview

OR Gate

A fundamental digital logic gate that implements logical disjunction. It produces a HIGH output if any of its inputs are HIGH. The output is LOW only when all inputs are LOW.

Logic ComponentsDigital Logic

Overview

The OR Gate evaluates multiple digital signals and returns true (HIGH) if any single condition is met. It is widely used in control logic, alarm systems, and conditional branching in digital circuits.

Pin Reference

PinTypeDescription
IN1inputFirst digital logic input. Expects HIGH (1) or LOW (0).
IN2inputSecond digital logic input. Expects HIGH (1) or LOW (0).
OUTdigitalDigital logic output. Driven HIGH if IN1 or IN2 is HIGH.

Configurable Attributes

This component currently has no configurable attributes.

Working Principle

Truth Table

IN1IN2OUT
0 (LOW)0 (LOW)0 (LOW)
0 (LOW)1 (HIGH)1 (HIGH)
1 (HIGH)0 (LOW)1 (HIGH)
1 (HIGH)1 (HIGH)1 (HIGH)

The OR Gate models Boolean addition (A + B = Y).

Wiring Diagram

Example of a logic OR gate wired to an Arduino Uno and an LED (with a resistor).

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("OR 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.

Released under the MIT License.