LEDs MUST BE WIRED CORRECTLY
Light-emitting diodes (LEDs) are simple devices but they do have a polarity. This means that it's possible to insert one in a circuit backwards. Depending on the circuit and the sketch being run by the Arduino this may result in odd lighting behaviors or refusal to light at all.
Each ordinary LED has two wires, called the anode and the cathode. In our circuits the anode is almost always connected to a current-limiting resistor while the cathode is connected to ground (GND). The current-limiting resistor, in turn, is usually connected to a digital pin on the Arduino.
Anode: The wire of an LED to be connected to positive, usually a current-limiting resistor of 220 ohms.
Cathode: The wire of an LED to be connected to negative, usually ground (GND) of the Arduino.
TWO TYPES OF LEDS
These lessons use LEDs with two different ways of identifying the anode and cathode. The use of the flat spot to indicate the cathode is the more common:
The less common packaging indicates the anode with a notch: