can I connect 2 leds to one output?

I will explain
I want to send to digital output -HIGH\LOW
if LOW led1 will be turn on
if HIGH led 2 will be turn on
maybe something with pullup on digital output?

will this work?

pullup-2leds.png

will this work?

It will once you put a resistor in line with the digital output. Use something like a 220R.

But make sure 5V is never applied when there is no digital output, so to be on the safe side put a 120R in each leg of the LEDs, so that is 5V -> LED anode, LED cathode ->120R -> digital output and another 120R -> LED anode, LED cathode -> ground.

Add a series dropping resistor for "each" LED.

Sure, just put a current limit resistor between the Arduino pin and each of the LEDs. Limit the current to 10mA with ~250 ohm resistor.
When Arduino pin is high, top LED turns on.
When low the bottom LED turns on.
When set to an input pin, both LEDs may turn on, depending on their Vf. You will +5-anode-cathode-resistor-(Arduino input)-resistor-anode-cathode Gnd. If Vf is low enough (<2.5V), then 2 LEDs in series with 500 ohm resistance could have maybe 0.5mA flowing, the LEDs may turn on dimly.

Yes guys that is exactly what I said, the topology is identical.

Ok, I guess we're all in agreement then 8)

Just connect the LEDs as shown:

Of course this will not work :roll_eyes:

2015-10-28_16-00-40.jpg
.

D1 will turn on/off 8).
D2, not so much.

I have been spending way too much time with bipolar power supplies. 8)

so to connect like this ?

and to define D5 as a normal output , right?
pinMode(5,OUTPUT);

so when
D5=HIGH: LED1-->On,LED2-->Off
D5=LOW : LED1-->Off,LED2-->On

Yes that is the way to do it.

Thanks ,