I don't understand why I need a resistor from an LED into ground if the LED is plugged into one of the pins. The Arduino is supplying power to the LED so surely it can withstand whatever the LED gives out when going into ground? Thanks in advance, ell.
A led has a fixed pressure (voltage) drop. For the remaining voltage a resistor is used, if choosen correctly it restricts the current flowing through the led.
To expand on what mechatron said, the LED appears to the Arduino as a short circuit, since the resistance of an LED is nearly 0. The resistor and LED combination have some resistance, which, using Ohms law, allows you to calculate the current flowing through the LED and resistor. You need to size the resistor to limit the current to what the Arduino is capable of providing.
The LED by itself will draw an infinite amount of current, and damage the Arduino.
Okay thanks. Sorry if this was obvious, my understanding of how electronics works is sort of limited (even though I got 100% on electricity module in Science GCSE) So the LED draws the current out as opposed to accepting what its given?
yes, whenever you connect something from + to gnd its going to draw as much current as it can before something breaks, so you have to restrict that flow so everything stays happy
this does not apply to ALL components, like capacitors have internal resistance that gets greater as it stores more energy, IC's have them built in, but for things like led's, transistors ...
LEDs need to be driven from a constant current source, which is approximated by an appropriate series resistor,
Don't forget it's not just about the Arduino pin. The LED, without having a resistor to help provide a controlled current source, can draw a larger value of current than it itself can tolerate... and then you get HEAT and ultimately release MAGIC smoke out of your LED.
You can drive an led like your grandpa drives his Buick on sunday or you can drive it like James Dean drove his Porshe 550.
You pick... but one of those ways has your LED living fast and dying young.
Current limitation is the largest benefit.
Your question is addressed here:- http://www.thebox.myzen.co.uk/Tutorial/LEDs.html