Home > Projects > LED Projects > Arduino Hello World Blink Code

Arduino Hello World Blink Code

Summary of Arduino Hello World Blink Code


This article demonstrates a fundamental Arduino project that blinks an LED on and off repeatedly, with each state lasting one second. The code utilizes two primary functions: `setup()`, which initializes pin 13 as an output, and `loop()`, which continuously toggles the digital pin high and low while inserting delays. This "Hello World" example illustrates basic Arduino syntax and hardware control for beginners.

Parts used in the Arduino Blink Project:

  • 1x 5mm red LED
  • 1x Arduino

This is a basic example how arduino works. In this arduino projects you’ll see how arduino control LED on for 1 second and off for 1 second repeatedly.

Arduino Hello World Blink

Instruction;
1) Connect cathode lead of LED (shorter lead) to ground pin and anode lead of LED (longer lead) to pin 13.

Upload this code to your arduino

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.This example 
code is in the public domain.

Code hosted at: arduinoprojects101.com
*/

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, HIGH);   // set the LED on
delay(1000);              // wait for a second
digitalWrite(13, LOW);    // set the LED off
delay(1000);              // wait for a second
}

There is 2 section of code arduino running, first setup() function which run once and second loop() function running continuously.

Arduino Hello World Blink Schematic

In setup function pinMode 13 declare as OUTPUT.

Major Components in Project
Parts List;
1) 1x 5mm red LED
2) 1x Arduino

For more detail: Arduino Hello World Blink Code

Quick Solutions to Questions related to Arduino Blink Project:

  • How does the Arduino control the LED?
    The Arduino controls the LED by setting pin 13 to HIGH for one second and then LOW for one second repeatedly.
  • Which pins should be connected to the LED leads?
    The cathode (shorter lead) connects to the ground pin and the anode (longer lead) connects to pin 13.
  • What are the two main sections of the Arduino code?
    The code consists of the setup function which runs once and the loop function which runs continuously.
  • What is the purpose of the pinMode function in this project?
    The pinMode function declares pin 13 as an OUTPUT within the setup section.
  • How long does the LED stay on and off?
    The LED stays on for one second and off for one second repeatedly.
  • Does the setup function run multiple times?
    No, the setup function runs only once when the program starts.
  • What type of LED is specified for this project?
    A 5mm red LED is specified for this project.
  • Can I use a different pin than pin 13?
    The article states that pin 13 has an LED connected on most Arduino boards and uses it specifically for this example.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top