Introduction to Arduino



Your First UNO Project

Activating UNO's On-Board LED






Overview:

    Our first project doesn’t require and wiring or external components, all we need to do is upload some code and view our results directly on the UNO. Fortunately, the UNO has a built in LED that is permanently connected to Pin 13 so we can access it without any outside connections.

    All we need to do is upload the code from this page and watch the LED react to our commands. This is a good time to take a look at the code and comments to start to get a feel for how it works. Change the two “delay” values and upload it again to see how the flashing pattern changes.

    Step 1: Connect your UNO to your computer with the USB cable.
    Step 2: Open the Arduino IDE and make sure your computer is communicating with your UNO (information about this can be found on previous pages of this website).
    Step 3: Copy the code from the bottom of this page.
    Step 4: Paste the code in the empty white code section of the IDE.
    Step 5: Upload the code to your UNO (click on the upload button).
    Step 6: Notice the on-board LED will blink at predetermined intervals.
    Step 7: Change the “delay” values in the code and upload it again. Notice the difference the changes make in the flashing pattern. Now take some time to try and recognize what each line of the code is doing.

    Congratulations, you have just created and run your first UNO project.


Parts List:
    1 Arduino UNO R3


Code:

    //------------- Code Starts Here ----------------------------
    
    //-----------------------------------------
    //Published by IntroductionToArduino.com
    //Created by Paul Illsley (www.paulillsley.com)
    //Please use and share so others can enjoy
    //-----------------------------------------
    
    void setup() {
    // setting pin 13 (the LED) as an output (this is the pin for the UNO's on-board LED).
      pinMode(13,OUTPUT);
    }
    
    void loop() {
      // setting the voltage of pin 13 to HIGH (5 volts), the LED turns on
      digitalWrite(13,HIGH);
    
      // delay 1000 milliseconds (1 second)
      delay(1000);
    
      // setting the voltage of pin 13 to LOW (0 volts), the LED turns off
      digitalWrite(13,LOW);
    
      // delay 1000 milliseconds (1 second)
      delay(1000);
    }
    //------------- Code Stops Here ----------------------------
    
    
    


    Created by Paul Illsley

    Return to www.introductiontoarduino.com