Blinking LED With Arduino Uno.

First off, consider the throwie: a simple, fun circuit that lets you light up the town.

Grab your LED and check it out. One long leg and one short. The long leg is positive. The short leg is negative, and you can remember because that side of the LED is slightly flattened, like a –.

Grab your Arduino, and start making your first basic project of Arduino!

Step 1: Things Required.

Go to your Electrical Shop and gather the following things:

1. LEDs

2. Arduino Uno R3

3. Arduino Cable

Bust out your computer and install the latest complete version of the Arduino IDE, from the top of this page: https://www.arduino.cc/en/Main/Software
Plug your Arduino board into a USB port on your computer. Get out your components. All set!

Step 2: Assembling the Circuit.

Grab your LED and check it out. One long leg and one short. The long leg is positive. The short leg is negative, and you can remember because that side of the LED is slightly flattened. (shown in the video)

Connect the Arduino with the computer through the Arduino Cable.

Like most Arduino boards, the Uno comes with a built-in LED that's connected to digital pin 13. Upload the code and watch it flash on and off, changing once per second.
Now, do the same thing with an external LED! Grab yours and plug the long positive leg into the header at digital pin 13. Plug the short leg into the GND (ground) header. You can also move the positive leg to any of the other digital pins, and change the "13" in your code to match. (As shown in the diagram).

Step 3: The Coding Part.

To blink the LED takes only a few lines of code. The first thing we do is define a variable that will hold the number of the pin that the LED is connected to. We don't have to do this (we could just use the pin number throughout the code) but it makes it easier to change to a different pin.

In our setup section, we're telling it that there is a controllable output on digital pin 13.
Once setup is done, the loop section takes over and (as the name implies) runs over and over again until the board is powered off. Our loop turns the LED on (HIGH) or off (LOW) every 1 second (1000 milliseconds).

Step 4: The Code.

/* Blink Turns on an LED on for one second, then off for one second, repeatedly. Most Arduinos have an on-board LED you can control. On the Uno and Leonardo, it is attached to digital pin 13. If you're unsure what pin the on-board LED is connected to on your Arduino model, check the documentation at http://www.arduino.cc This example code is in the public domain. modified 8 May 2014 by Scott Fitzgerald */ // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output. pinMode(13, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(13, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }

Step 5: Here We Go, Your LED Starts to BLINK!

After uploading the code to the board, the LED starts to blink.

The blinking speed can be changed by changing the values of "delay".

Now, here we go, your first ever Arduino Project is ready. Keep experimenting by changing the values and enjoy.

Share

    Recommendations

    • Arduino Contest 2019

      Arduino Contest 2019
    • Tape Contest

      Tape Contest
    • Trash to Treasure

      Trash to Treasure

    Discussions