Why a resistor to ground?

I'm sure this is a total n00b question, so apologies in advance, but I'm reading my Arduino starter manual and on project 2 the space ship interface, I noticed that LEDS are connected back to ground through a resistor. Where as in project 1 a resistor is used from power before the LED. The latter made sense to me as to reduce the amount of current to the LED, but the former doesn't compute? Why do we need a resistor to ground?

It doesn't matter which side of the LED you wire the current-limiting resistor

Okay, I think I understand. So a resistor will effect the whole circuit? I thought that before the resistor would be at a normal level and after the resistor would be reduced (like a dam). Is there a physical law that explains this that I can read more about?

Need a resistor in series with the LED.

pin-anode, cathode-resistor-Gnd. Requires High on pin to turn LED on. Also acceptable: pin-resistor-anode, cathode-Gnd.

+5-resistor-anode, cathode-pin. Requires Low on pin to turn LED on. Also acceptable: +5-anode, cathode-resistor-pin.

The resistor determines the amount of current that will flow in the LED. Most LEDs have a max of 20mA. So: (5V-Vf of LED)/20mA = resistor value needed. Ex for typical Red LED: (5V-2.2V)/.02 = 140 ohm. 150 is standard value use that (5V-2.2V)/150 ohm = 18.6mA of current

I think the applicable law is Kirchoff's

You guys rock, thank you for being so responsive.

Also, while looking around on electronics stackexchange, I found this which was helpful to me. Posting in case any other nubs stumble across this:


Endolith (second voted answer at this time) illustration was useful for me.

Thanks again guys.