A resistor - as its name suggests - resists the flow of electrical current in a circuit. The effect of placing a resistor in a circuit is to reduce the voltage seen by any other components. Some of the electrical energy is lost as heat from the resistor. Voltage, current and resistance are related through Ohm's law (Voltage = Current x Resistance ) :
Resistance is measured in Ohms (symbol Ω). In many simple cases, it is only important to choose a resistor with a value that is approximately correct. Precise resistances can be calculated using Ohm's law if needed. For many Arduino projects, resistors of 220Ω or 1kΩ usually perform quite well.
What is the resistance value?
Resistors have coloured bands on them to show their resistance value. These can be difficult to read, so you may need a magnifying glass. The chart below shows the coding scheme.
Uses of resistors
Resistors are versatile components which can be combined with other components in interesting ways. At the basic level, there are three specific uses that you should be aware of:
Current-limiting resistors: To protect components like LEDs from damage, a resistor can be placed in series to reduce the current flow in the circuit. Resistance values are typically in the range 300Ω - 1kΩ.
Pull-up/pull-down resistors: Circuits may be affected by electromagnetic fluctuations in the environment. This can affect idle circuit elements - those waiting for a low or a high signal. To ensure that an idle element reads as high or low in its idle state (as appropriate), a resistor can be used to connect it to a voltage source or to ground. Resistance values are high - 10kΩ or more. Pull-down resistors are used with pushbuttons.
Voltage dividers: If two resistors are connected in series with one connected to a 5V source and the other to ground, the voltage measured between the resistors is a value between 0 an 5V that depends on the ratio of the resistance values. A voltage divider is needed with any sensor such as a light-dependent resistor (LDR) whose resistance changes in response to some external quality.
The resistors in the diagram below illustrate the first two uses.