If you want to Blink an external LED with this Code using Arduino, you need to build this circuit, where you connect one end of the resistor to the digital pin correspondent to the LED_BUILTIN constant. 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 GND. In the diagram below we show a UNO board that has D13 as the LED_BUILTIN value. The value of the resistor in series with the LED may be of a different value than 220 ohms; the LED will lit up also with values up to 470 ohms.
COMPONENTS
- Arduino Uno – 1 | purchase
- LED – 1 | purchase
- Resistor 220/470 ohm – 1 | purchase
- Breadboard – 1 | purchase
- Connecting Wires as required | purchase
CONNECTIONS
PROGRAM | ARDUINO LED BLINK CODE
/*UNCIA ROBOTICS | www.unciarobotics.com
PROGRAM: ARDUINO LED BLINK CODE
Turns on and off a light-emitting diode(LED) connected to digital
Connections:
13 LED(+)
GND LED(-)
*/
void setup() {
pinMode(13, OUTPUT); // sets the digital pin 13 as output
}
void loop() {
digitalWrite(13, HIGH); // sets the digital pin 13 on
delay(1000); // waits for a second
digitalWrite(13, LOW); // sets the digital pin 13 off
delay(1000); // waits for a second
}
FUNCTIONS USED
void setup( )
This function is called when a sketch starts. After that, You can use to initialize variables, pin modes, start using libraries, etc. This function will only run once, after each power-up or reset of the Arduino board.
void loop ( )
This function is called just after calling setup(). As the name suggests this function actively controls the Arduino board by looping consecutively.
pinMode ( )
Description: Configure specific pin to behave either as input or output.
Syntax: pinMode (pin,MODE);
- pin: the Arduino pin number to set the mode of.
- MODE: INPUT, OUTPUT, or INPUT_PULLUP.
Returns: Nothing
Notes and Warnings:
- It is only applicable to digital pins.
digitalWrite ( )
Description: Write a HIGH or LOW value to a digital pin.
Syntax: digitalWrite (pin,VALUE);
- pin: the Arduino pin number.
- value: HIGH or LOW
Returns: Nothing
Notes and Warnings:
- It is very important to set pinMode() as OUTPUT first before using digitalWrite() function on that pin.
- If you do not set the pinMode() to OUTPUT, and connect an LED to a pin, when calling digitalWrite(HIGH), the LED may appear dim.
- The analog input pins can be used as digital pins, referred to as A0, A1, etc. However, the exception is the Arduino Nano, Pro Mini, and Mini’s A6 and A7 pins, which can only be used as analog inputs.
delay ( )
Description: Pauses the program for the amount of time (in milliseconds) as specified inside the bracket. (1sec = 1000 ms).
Syntax: delay (ms);
- ms: the number of milliseconds to pause. Allowed data types: unsigned long
Returns: Nothing
Notes and Warnings:
- While it is easy to use delay function for short pauses in a program, but the use of delay() has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect. Therefore it brings most other activity to a halt.
- Certain things do go on while the delay function is controlling the Atmega chip. However, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (analogWrite) values and pin states are maintained.
FAQ’s
How do I make my LED blink Arduino?
You have to compile the given Program in Arduino IDE and upload it to the Arduino board. If your connections are correct. LED will start Blinking.
How do I increase or decrease the Blinking Frequency/Speed of an LED?
Well for that you have to change the parameter of delay function inside the bracket.
How to identify Positive(anode) and Negative (cathode) of an LED?
There are two Ways to identify this.
- Check the legs of an LED. Positive Leg is always longer than the Negative
- Check the Flags inside the LED. Bigger Flag is Negative and smaller one is positive.
Still, having doubts?
Ask your questions in comment section below or Contact us.

Thanks for the information
Great Design !! very helpful