recognize if a led is connected on a digital out

Hi all,

is there a simple way in the setup to recognize if a led is connected on a digital out?

Thanks for any hints,
Rudi

do you mean for the Arduino to electrically see if an LED is connected or not, rather than checking to see if it lights?

Grumpy_Mike:

ruvy:
Hi all,

is there a simple way in the setup to recognize if a led is connected on a digital out?

Thanks for any hints,
Rudi

No, there is no easy or indeed difficult way to do this.

Can't you measure the Arduino current usage with something? Now turn the resistor on/off and see if it changes.

A vision system looking for a flashing LED...?

What are you trying to do Rudi ?

Boffin1:
What are you trying to do Rudi ?

After reset i need to initialize if some sensors are connectet or not. this is important for the code in the loop.
A Connector in this case is a small box, one type is an LDR with an Control LED, other is a hall sensor with a Controll led.
In the loop i wait for input of one of this sensor boxes, selected by random.
In the selected box the led is on, for the user to see whats the next box

All is a game for R/C

So, before i initialize my "Random Machine" i need to know how much of this Sensors/LEDs are connected to the Arduino.

Thanks!

Heres a plan that might work to see if your sensor box is plugged in :-

If you run the LED from an Analog pin , which is set to input, and high ( so as to set its pullup resistor ) you could then AnalogRead the voltage on the pin.

If there is no LED to ground you will get 5v, but if the LED ( red?) is connected you will see 2v.

The LED will probably glow from the current of the pull-up resistor, but once you have established the LED is there, you can switch the pin back to output to turn on the LED when you want.

Boffin1:
Heres a plan that might work to see if your sensor box is plugged in :-

If you run the LED from an Analog pin , which is set to input, and high ( so as to set its pullup resistor ) you could then AnalogRead the voltage on the pin.

If there is no LED to ground you will get 5v, but if the LED ( red?) is connected you will see 2v.

The LED will probably glow from the current of the pull-up resistor, but once you have established the LED is there, you can switch the pin back to output to turn on the LED when you want.

Great! thank you!

You could change a pin from (output, high) to (input, low) and see how it behaves while floating. A loaded pin will behave differently than an unloaded pin. But this is neither very easy nor very reliable.

If the led has it's cathode lead wired to ground then you could just run a wire from the anode lead of the led to a analog input pin. It will read the Vf voltage value of the led when it's on and 0 when it's off.

Lefty

Lefty

thx all, i will give a try to this solutions!

Nice day, Rudi