Button with led (how to connect?)

I have an arcade like button that has a LED inside, is this schematic correct for it to light when I press it?

Thanks!

That won't work well.

Use the LED and resistor as a pull-down resistor on the Arduino pin. Use the button to connect the pin to +5. This will cause the pin to go from LOW to HIGH and light the LED at the same time.

Ohhhhhhhhhhhhhhhhhh... you mean like this?
That makes sense...

Led Button.jpg

I just noticed I put the LED the other way!
But everything else is right I think

Pancra85:
I just noticed I put the LED the other way!
But everything else is right I think

Yes. Exactly.

THANKS!!!

Will that actually act as a pull-down when off, as the led diode won't be forward biased at that time, I don't see how it can have a significant electrical influence on the input pin to force it to a logic 0. I question if there might still be a floating input condition when switch is inactive? I would think a diode that was not in forward bias condition would just act more like a very small capacitance wired from the input pin to ground.

Lefty

wait... retrolefty is right, when button is not pressed the output is floating, a solution anyone?

Pancra85:
wait... retrolefty is right, when button is not pressed the output is floating, a solution anyone?

Well you could just wire an additional resistor of say 10k ohms from the input pin to ground. Nothing like a real pull-down when you just need a real pull-down. :wink:

Lefty

let me see if I understood, by putting a small resistor on the INPUT PIN you will force the current trough there when the button is not pressed? I am not sure I got that right.

you mean exactly like the attached picture?

Yes, attached drawing should work great. Note that hardly any current actually flows through the 10k resistor when the switch is off, but it does establish a legal electrical 0 volts to the input pin to prevent the infamous 'floating input pin' condition.

Good luck;

Lefty

ok, perfect!
but there is something I don't understand, without the 10K Resistor why the current doesn't goes to GND, even if it has a Resistor it's the only way, right?

Pancra85:
ok, perfect!
but there is something I don't understand, without the 10K Resistor why the current doesn't goes to GND, even if it has a Resistor it's the only way, right?

Don't quite understand your question, do you mean using only the series resistor and led why is that not a path to ground? If that is your question, is because the led is not biased to be in a conduction mode, it's 'cut-off'. If that is not your question perhaps you could reword it?

Lefty

yes, that was my question.
by biased you mean that the led should be spin in order to let the current go to GND?