Comparator is also the same but with a diff being tat its digital so u have to two states high(5V) and low(0V).
Above figure shows the general ckt diagram of a comparator .If V1>V2 then Vout=+Vcc and if V1 if V1 is less than V2 then Vout is minus Vcc
Lm 324 has 4 such comparator(shown in figure1) them also known as Quad opamp.
LM 358N has 2 comaprator also known as bi opamp.
U can use two potentiometers(of 10 K prefarably) and put them across pin2 and pin 3 , and put an led in series with a resistance at pin 1 , when the voltage drop in pot 1 connected across pin 2 is low , u can c the led glow.