To build the circuit, connect one end of the resistor to Arduino pin 13. Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the Arduino GND, as shown in the diagram above and the schematic below.

to:

To build the circuit, connect one end of the resistor to Arduino pin 13. Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the Arduino GND, as shown in the diagram and the schematic below.

To build the circuit, attach a 220-ohm resistor to pin 13. Then attach the long leg of an LED (the positive leg, called the anode) to the resistor. Attach the short leg (the negative leg, called the cathode) to ground. Then plug your Arduino board into your computer, start the Arduino program, and enter the code below.

to:

To build the circuit, connect one end of the resistor to Arduino pin 13. Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the Arduino GND, as shown in the diagram above and the schematic below.

Changed lines 39-40 from:

In the program below, the first thing you do is to initialize pin 13 as an output pin with the line

to:

In the program below, the first thing you do is to initialize pin 13 as an output pin with the line

To build the circuit, get an LED and attach its long, positive leg (called the anode) to pin 13. Attach the short negative leg (called the cathode) to ground. Then plug your Arduino board into your computer, start the Arduino program, and enter the code below.

to:

To build the circuit, attach a 220-ohm resistor to pin 13. Then attach the long leg of an LED (the positive leg, called the anode) to the resistor. Attach the short leg (the negative leg, called the cathode) to ground. Then plug your Arduino board into your computer, start the Arduino program, and enter the code below.

Deleted lines 31-32:

If you've got experience with electronics, you may notice that the LED doesn't have a resistor in series with it. This is because the amount of current coming out of the output pin of the Arduino is low enough that it won't damage the LED. This simplifies the circuit for beginners to delete the resistor. In general practice, though, it's a good idea to add a resistor in series with the LED.

To build the circuit, get an LED and attach its long, positive leg (called the anode) to pin 13. Attach the short negative leg (called the anode) to ground. Then plug your Arduino board into your computer, start the Arduino program, and enter the code below.

to:

To build the circuit, get an LED and attach its long, positive leg (called the anode) to pin 13. Attach the short negative leg (called the cathode) to ground. Then plug your Arduino board into your computer, start the Arduino program, and enter the code below.

Blink

In most programming languages, the first program you write prints "hello world" to the screen. Since an Arduino board doesn't have a screen, we blink an LED instead.

to:

Examples > Basics

Blink

This example shows the simplest thing you can do with an Arduino to see physical output: it blinks an LED.

Deleted line 12:

Changed lines 15-18 from:

The boards are designed to make it easy to blink an LED using digital pin 13. Some (like the Diecimila and LilyPad) have the LED built-in to the board. On most others (like the Mini and BT), there is a 1 KB resistor on the pin, allowing you to connect an LED directly. (To connect an LED to another digital pin, you should use an external resistor.)

LEDs have polarity, which means they will only light up if you orient the legs properly. The long leg is typically positive, and should connect to pin 13. The short leg connects to GND; the bulb of the LED will also typically have a flat edge on this side. If the LED doesn't light up, trying reversing the legs (you won't hurt the LED if you plug it in backwards for a short period of time)

to:

To build the circuit, get an LED and attach its long, positive leg (called the anode) to pin 13. Attach the short negative leg (called the anode) to ground. Then plug your Arduino board into your computer, start the Arduino program, and enter the code below.

Most Arduino boards already have an LED attached to pin 13 on the board itself. If you run this example with no hardware attached, you should see that LED blink.

Added lines 23-24:

image developed using Fritzing. For more circuit examples, see the Fritzing project page

Changed lines 30-33 from:

click the image to enlarge

to:

If you've got experience with electronics, you may notice that the LED doesn't have a resistor in series with it. This is because the amount of current coming out of the output pin of the Arduino is low enough that it won't damage the LED. This simplifies the circuit for beginners to delete the resistor. In general practice, though, it's a good idea to add a resistor in series with the LED.

Changed lines 36-39 from:

Code

The example code is very simple, credits are to be found in the comments.

to:

Code

In the program below, the first thing you do is to initialize pin 13 as an output pin with the line

pinMode(13, OUTPUT);

In the main loop, you turn the LED on with the line:

digitalWrite(13, HIGH);

This supplies 5 volts to pin 13. That creates a voltage difference across the pins of the LED, and lights it up. Then you turn it off with the line:

digitalWrite(13, LOW);

That takes pin 13 back to 0 volts, and turns the LED off. In between the on and the off, you want enough time for a person to see the change, so the delay() commands tell the Arduino to do nothing for 1000 milliseconds, or one second. When you use the delay() command, nothing else happens for that amount of time. Once you've understood the basic examples, check out the BlinkWithoutDelay example to learn how to create a delay while doing other things.

Once you've understood this example, check out the DigitalReadSerial example to learn how read a switch connected to the Arduino.

Circuit

LEDs have polarity, which means they will only light up if you orient the legs properly. The long leg is typically positive, and should connect to pin 13. The short leg connects to GND; the bulb of the LED will also typically have a flat edge on this side. If the LED doesn't light up, trying reversing the legs (you won't hurt the LED if you plug it in backwards for a short period of time).

/* Blink Turns on an LED on for one second, then off for one second, repeatedly. The circuit: * LED connected from digital pin 13 to ground. * Note: On most Arduino boards, there is already an LED on the board connected to pin 13, so you don't need any extra components for this example. Created 1 June 2005 By David Cuartielles http://arduino.cc/en/Tutorial/Blink based on an orginal by H. Barragan for the Wiring i/o board */

* ------------
*
* turns on and off a light emitting diode(LED) connected to a digital
* pin, in intervals of 2 seconds. Ideally we use pin 13 on the Arduino
* board because it has a resistor attached to it, needing only an LED

February 15, 2008, at 11:59 PM
by David A. Mellis - clarifying that some boards have built-in leds, others have 1 KB resistor on pin 13

Changed lines 5-10 from:

The first program every programmer learns consists in writing enough code to make their code show the sentence "Hello World!" on a screen.

As a microcontroller, Arduino doesn't have any pre-established output devices. Willing to provide newcomers with some help while debugging programs, we propose the use of one of the board's pins plugging a LED that we will make blink indicating the right functionallity of the program.

We have added a 1K resistor to pin 13, what allows the immediate connection of a LED between that pin and ground.

to:

In most programming languages, the first program you write prints "hello world" to the screen. Since an Arduino board doesn't have a screen, we blink an LED instead.

The boards are designed to make it easy to blink an LED using digital pin 13. Some (like the Diecimila and LilyPad) have the LED built-in to the board. On most others (like the Mini and BT), there is a 1 KB resistor on the pin, allowing you to connect an LED directly. (To connect an LED to another digital pin, you should use an external resistor.)

Code

The example code is very simple, credits are to be found in the comments.

[=
/* Blinking LED

* ------------
*
* turns on and off a light emitting diode(LED) connected to a digital
* pin, in intervals of 2 seconds. Ideally we use pin 13 on the Arduino
* board because it has a resistor attached to it, needing only an LED

This example blinks the LED on pin 13, turning it on for one second, then off for one second, and so on.

to:

The first program every programmer learns consists in writing enough code to make their code show the sentence "Hello World!" on a screen.

As a microcontroller, Arduino doesn't have any pre-established output devices. Willing to provide newcomers with some help while debugging programs, we propose the use of one of the board's pins plugging a LED that we will make blink indicating the right functionallity of the program.

We have added a 1K resistor to pin 13, what allows the immediate connection of a LED between that pin and ground.

LEDs have polarity, which means they will only light up if you orient the legs properly. The long leg is typically positive, and should connect to pin 13. The short leg connects to GND; the bulb of the LED will also typically have a flat edge on this side. If the LED doesn't light up, trying reversing the legs (you won't hurt the LED if you plug it in backwards for a short period of time).