BLINK YOUR ARDUINO

In this tutorial we will learn how to blink the LED that is already on our ARDUINO.

You may find that your Arduino board’s ‘L’ LED already blinks when you connect it to a USB plug. This is because Arduino boards are generally shipped with the ‘Blink’ sketch pre-installed.

In this lesson, we will reprogram the Arduino with our own Blink sketch and then change the rate at which it blinks.

In Lesson 1, you setup your Arduino IDE and made sure that you could find the right serial port for it to connect to your Arduino board. The time has now come to put that connection to the test and program your Arduino board.

To check the right serial port go to Tools>port.

The Arduino IDE includes a large collection of example sketches that you can load up and use. This includes an example sketch for making the ‘L’ LED blink.

Load the ‘Blink’ sketch that you will find in the IDE’s menu system under File → Examples → 01.Basics

arduino-photos-blog-1

arduino-photos-blog-2

EXPLANATION OF THE CODE :-

Firstly, we gave our led 13 a name, say,  led.

Now we enter the setup function.

As the variable led is already assigned a value of 13, pinMode(led, OUTPUT) decides that the led will give the desired output of the following code assigned to it in the loop.

Now enter the LOOP function.

digitalWrite(led, HIGH) turn ON the LED which is assigned at pin 13
digitalWrite(led,LOW) turn it off.
In between them we have a delay of 1000. Here 1000 means 1 second.
We can manipulate te code by blinking it very fast by assigning it a delay of 500 or 100. That is half a second or one-tenth of a second.

UPLOAD your code by clicking on the arrow below the ‘EDIT’ option.

the LED on your board will blink according to the delay set by us.

You have successfully completed your first project.!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s