Click the input switches or type the ('a','b','c') and ('d','e') bindkeys to control the circuit and watch the behavior.
The upper circuit uses three relays, with the coil of each relay connected to one input and ground. Therefore, the relays will activate whenever their corresponding input is driven to a (strong) high level.
A series connection of the switches insures that the output of the AND gate is only driven high when all relays are active. The net result is the logical AND of the three inputs. Here, a strongly-driven high-value at the output is interpreted as a logical 1, while an open (floating) output is interpreted as a logical 0.
The lower circuit demonstrates the corresponding NAND gate with two inputs. A parallel-connection of the relay switches ensures that the output will be logical-1 while at least one relay remains inactive.
Run the applet | Run the editor (via Webstart)