Project 02 Spaceship-Interface 10k resistor?

Hello Guys!

Just starting out and I can't understand why I do need a 10k Ohm resistor after the Button to read the status?

Why I do need such a high resistor before the GND.
The LEDs using only 220ohm, ok that I can calculate.

But why is there a 10k Ohm resistor?
Any help would be appreciate it!
I read about the float current but actually not understand it.
Thanks

Welcome to the forum

The 10K resistor keeps the pin in a LOW state until the button is pressed. The comparatively high value of the resistor ensures that only a small amount of current flows

Keeping the pin in a known state at all times prevents the input floating at an unknown, maybe HIGH, maybe LOW state when the button is not pressed. The resistor is technically known as a pulldown resistor

1 Like

Hi!
Thank you very much, now I get it!

Welcome to the forum
Be aware that, although this gives a good example of preventing a floating pin, it is not the typical way a button is wired in arduino. Because the microcontroller has internal resistors connected to VCC (5V) that can be activated in the code (PinMode input pullup) it makes sense to use these rather than to add an external resistor. It achieves exactly the same thing but pulls the pin high rather than low so the logic is reversed compared to your example. You wire the button to GND and When you push the button the pin is pulled low and thus LOW == pressed.

The concept to be aware of is that the pin can not be left “floating” ie not connected to a reference voltage (gnd or vcc via appropriate resistor) as the voltage detected at the pin will then be indeterminate ie it can float around from high to low picking up interference etc and can not be trusted to be any particular voltage and thus can’t be used in button logic.

1 Like

Hello!

Thank you for taking the time, this will help me in further projects.
There's a lot to learn now for me, this forum is a great help!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.