i was speaking more about the tangent they were going off about on the input.
i just didn't understand why they use 2 resistors and put the input between them, like i said i believe it was so the input wasn't floating.
The two resistors form a voltage divider. Forget about the Arduino for a second....pretend it doesn't exist. All you have is a voltage source, and two resistors in series. If you put in a voltage V, and measure across BOTH resistors, you will measure V for a voltage. It's basically equivalent to measuring the source with respect to ground...do you see that?
Now let's figure out the current across both resistors. For resistors in series, the total resistance is R1 + R2 = 1100k. Let's say you put in 10V.
V = IR
10V = I * 1100k
I = 10V/1100k = 9.09uA. (ok...it's 9.090909090909..... uA, but 9.09 is close enough)
So now we know that you will see 9 micro amps of current going through the circuit, for 10V.
OK, so now let's figure out the voltage drops across the two resistors. We already know that if you measure across BOTH resistors, you must get 10V, so the voltage drop across the individual resistors must add up to 10V. That's a good way to check you're work.
V=IR
for the 1M resistor
V= 9.09uA * 1000k = 9.09V
for the 100k resistor
V = 9uA * 100k = .909V
9.09V + .909V = 9.999V (would be exactly 10V except for rounding errors)
So hookup the Arduino again. It's measuring the voltage across the small resistor...do you see that? Look where it's measuring. Pretend it was a voltmeter instead, and put one probe where the arduino hooks up, and the other one to ground. What's it measuring? It's across the small resistor. What's the voltage? It's .909V, which is 1/11 of the 10V input. See, it's dividing the voltage.... 1/11 gets dropped across the small resistor, and 10/11 gets dropped across the big resistor. If you measure across both resistors, you get the full voltage back (11/11 = 1
)
And you can use 3 resistors...and 4 resistors...and however many you want. You figure it out exactly the same way. Calculate the current through the entire circuit, and then calculate the drops across the individual resistors. Of course, you could be clever about it and notice that you really end up with the simple ratio
R2/(R1+R2)
This is what it means to have a voltage divider, and it's a very very very very important concept. From this concept, you not only build up simple dividers like this, just to scale the voltage, but more generally you will use this concept with capacitors to build various kinds of filters.
I feel like you need to go back and study how to calculate voltages and currents through series and parallel circuits. There's no way to understand what's going on here without a solid understanding of that.
I hope that helps.