Meet the Logic Gates!
Logic gates are like “secret switches” inside every computer. They follow simple rules to decide if a light should turn ON or OFF.
The “BOTH” Gate (AND)
The AND gate is very strict! The light only turns ON if BOTH switches are ON.
Imagine you need two keys to open a treasure chest—you need Key A AND Key B!
Goal: Set inputs so the output bulb glows (Output = 1).
The “EITHER” Gate (OR)
The OR gate is much friendlier. The light turns ON if AT LEAST ONE switch is ON.
It’s like having two doors to a room—you can use Door A OR Door B to get inside.
Goal: Set inputs so the output bulb glows (Output = 1).
The “ONLY ONE” Gate (XOR)
The XOR gate is a bit picky. It only turns ON if EXACTLY ONE switch is ON.
If both are OFF, it’s OFF. If both are ON, it’s also OFF! They must be different.
Goal: Set inputs so the output bulb glows (Output = 1).
The “OPPOSITE” Gate (NAND)
The NAND gate is a prankster. It does the exact opposite of the AND gate!
The light is usually ON, but if you turn BOTH switches ON, it ZAPS out!
Goal: Set inputs so the output bulb glows (Output = 0).