LEDs are amazing! They use very little power for the light they produce. When you are using an LED to indicate the status of a circuit, they may be using only 20mA (or even only 1mA!). An early lesson in electronics is to connect an LED into a circuit, similarly one of the most common first activities while learning about Arduino is to blink an LED. Something that must be considered when powering a LED is the current it is rated for in operation, called Forward Current.
An LED in a circuit without a limiting resistor can exceed its operating current rating quite easily and burn out in a short time. For many projects a resistor rated at 1/8W or 1/4W will be fine, but you may want to check for long term or high power use to make sure. To calculate the resistor values needed to protect the LED, use Ohm’s Law.
Your essential Ohm’s Law equation V=IxR is used to calculate the resistor value you’ll need in the circuit. In this case we’ll rearrange it to R=V/I, and we have to add terms for LEDs (and standard diodes) called Forward Voltage and Forward Current. The forward voltage is the voltage drop across the LED. It is typically in the range of 2-3V. This forward voltage is important to consider using one LED and even more important when using many LEDs since your circuit will not work if the combined forward voltage exceeds your supply voltage.
Adding forward voltage (VF), explicitly stating our supply voltage (VS), and forward current (IF), our R=V/I equation becomes RLED=(VS-VF)/IF. We’re almost ready to plug and chug! To find your resistor value, you’ll just need the VF and IF for the LED (again typically 2-3V and 10-20mA depending on type), and your chosen supply voltage (Vs).
Let's use a red LED with a VF of 2V and IF of 20mA, powered by 5V for example: RLED=(5V-2V)/20mA => RLED=150Ω, so in this case you can connect a 150Ω resistor in series with your LED and have just the right amount of current to light up your project.