Menu
CoddyTech

An LED of Your Own

Part of the First Circuits section of Coddy's Arduino journey. Lesson 4 of 22.

So far the LED came wired to pin 13. This one is on pin 8, wired the way every LED is.

An LED lets current through in one direction only. Its long leg, the anode (+), goes to the pin. Its short leg, the cathode, goes towards GND, short for ground: the board's 0 volts.

Between the LED and ground sits a resistor. It limits the current, the flow of electricity. Without it the LED lets far too much current through and can burn out, and damage the pin too.

The LED uses about 2V of the pin's 5V, and the 220 ohm resistor takes the other 3V. 3V divided by 220 ohm is about 14 mA (thousandths of an amp): bright enough to see, and under the 20 mA a pin should give.

challenge icon

Challenge

Easy

The red LED is wired to pin 8 through a 220 ohm resistor. Make it blink:

  • make pin 8 an output in setup()
  • in loop(), turn it on, wait, turn it off, wait (any speed you like)

Press Run to watch it, then Check.

Try it yourself

void setup() {
  // make pin 8 an output
}

void loop() {
  // blink the LED on pin 8
}
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in First Circuits

Practice on your own: Arduino playground