Choosing the appropriate resistor depends on the rated voltage and current of the LED. For example, if you are using a 2V, 20mA LED, you can choose a 300 ohm resistor. The calculation formula is: (power supply voltage - LED voltage) / LED current = resistance value.