How do I make a logic gate that takes 4 input and gives and output if only one is powered?
Being X
is your output, and A
, B
, C
and D
are your inputs,
X = ((A && !B && !C && !D) || (!A && B && !C && !D) || (!A && !B && C && !D) || (!A && !B && !C && D))
There are better methods, but this is one of the simplest to derive. &&
is an AND
gate, and ||
is an OR
gate.
The brackets group simultaneous lines/operations.