I'm just starting out with Arduino and am building a simple circuit from one of the example pieces of code. In the attached schematic, I am trying to figure out why the 10K resistor is necessary. Is my understanding below correct?
When the button is open, the input pin D2 would be connected through the 10K resistor to ground. Since D2 is designated in code as an input pin, there is no current flowing out of it, making the voltage drop across the 10K resistor 0 volts. So when the button is open, the D2 pin has a voltage of 0 volts (same as ground), so it is interpreted as a digital LOW signal.
On the other hand, when the button is closed (i.e., pushed down), D2 is connected directly to 5 volts and so is a logical HIGH value. At this point there is voltage difference of 5 volts across the 10K resistor and 500 uA of current will flow down to the ground pin. In the state when the button is closed, is the resistor really needed? Why can't the pin D2 just be connected to 5V without any flow of current for it be read as a digital HIGH signal?
Also is my terminology correct in calling this a pull down resistor?

When the button is open, the input pin D2 would be connected through the 10K resistor to ground. Since D2 is designated in code as an input pin, there is no current flowing out of it, making the voltage drop across the 10K resistor 0 volts. So when the button is open, the D2 pin has a voltage of 0 volts (same as ground), so it is interpreted as a digital LOW signal.
On the other hand, when the button is closed (i.e., pushed down), D2 is connected directly to 5 volts and so is a logical HIGH value. At this point there is voltage difference of 5 volts across the 10K resistor and 500 uA of current will flow down to the ground pin. In the state when the button is closed, is the resistor really needed? Why can't the pin D2 just be connected to 5V without any flow of current for it be read as a digital HIGH signal?
Also is my terminology correct in calling this a pull down resistor?
