I want to build a circuit that compares two potentials, in principle, it works like so:
basicly, the circuit gets 3 intputs, p1, p2 and input, and has one output, output. the potential of p1 would be, p1 and the potential of p2 would be, p2. when p1 and p2 are not equal, output's potential is 0, which means, no potential. when p1 and p2 are equal, input and output are "connected" and output's potential equals to input's potential. but if p1 and p2 are suddnly not equal (after they were equal, which means that input and output are "connected") input and output will still be connected, up until input's potential turns into 0. (if its more comfortable, i wouldn't mind adding a four'th input that would "disconnect" input and output. for example whenever it has a certain potential, input and output will be "disconnected")
EDIT: Some information: input's volt is 5V. the potentials vary based on the resistance the wires go through when they connect the p1 and p2 inputs, the resistance comes from a simple photo cells.