How to blink a LED light on Arduino

I started leaning Arduino these days and I am totally into it! The hardware stuffs have so much fun! I want to share what I learned a little bit about Arduino which is about how to blink a LED light on Arduino. So here is the easiest project that you can do.

◯What you need

  1. Arduino Uno

IMG_3198

    2. USB cable (Type A to B)

IMG_3199

◯What you code

In my tutorial, I will try to blink for each two second.

◯Explanation of each line of code

・#define LED_PIN 13

// This is able to define LED_PIN 13 as a constant value. (By you just change the code you define when you want to change, you can replace all the programming you code. Which means you do not have to change every single line of code.)

・void setup() {

 pinMode (LED_PIN, OUTPUT);

}

// It initializes the digital pin which is 13 from #define LED_PIN 13.

・void loop()

// The loop function is the function that runs repeatedly.

・digitalWrite (LED_PIN, HIGH);

// This turns on the LED light.

・delay (2000);

// Milliseconds. In this case, 2000 means 2 seconds.

・digitalWrite (LED_PIN, LOW);

// This turns off the LED light.

Leave a Reply

Your email address will not be published. Required fields are marked *