connecting a LED to an Arduino
The LED and the resistor are connected in series ("daisy-chained"). Because of that, the current through the LED and the resistor are equal (here: maximum 40mA or the Arduino will get damaged). Also, the voltage over the LED plus the voltage over the resistor is the total voltage (here 5V).
The forward voltage of the LED is 1.2V so there will be 5V - 1.2V = 3.8V over the resistor. Furthermore, we're going to aim for 20mA because you want the amount of current that all componens can handle: the LED can't handle 40mA but it can handle 20mA and the Arduino can handle both (of course) so we use 20mA. Now using the "R = V / I" formula (Ohm's law, resistance = voltage / current), we can determine that we want a resistor of at least(!) 190 Ω (ohm) (190 = 3.8 / 0.02 (you must calculate with A here so 20mA is 0.02A)).
Because of imperfection in all components, you want to have some headroom. So don't aim for 20mA but a bit below. Also take in consideration that most resistors are also not exactly the rating of what the color code say they are. And as a last thing: for example a 121 ohm resistor does not exist. So for this example: use a 220 ohm resistor and you're safe.