2 leds one comparator output

I would like to know if it is possible to control two leds separately using a single comparator output. ie above a certain voltage a green led is on and a red is off, below a certain voltage, the green led is off and the red is on.

Thank you in advance

Yes, if the comparator has an open collector output 1.

1 Like an LM339, for example.

I am totally unfamiliar with a comparator, but i am familir with charlieplexing, you could charlieplex 2 LEDs, and reverse polarity to switch LEDs.

Voidugu: I would like to know if it is possible to control two leds separately using a single comparator output. ie above a certain voltage a green led is on and a red is off, below a certain voltage, the green led is off and the red is on.

Where is this variable voltage coming from? If it is the analogWrite command be aware that this does not output a variable voltage but a pulse width modulated signal. You need a filter to make that an analogue voltage. http://www.thebox.myzen.co.uk/Tutorial/PWM.html