Wednesday 13 May 2015

Arduino Lesson 7 : LED blinking on Arduino UNO R3

Project :

We are going to do this project in which we can blink led either on board or off the board according to our wish.

Hardware required :

  1. Arduino UNO board.
  2. LED (of any color)
  3. Resister 330ohm (not mandatory)
  4. Connecting wires/Jumper wires.
  5. PC to configure arduino board (with arduino software installed).
  6. Bread board.


Fritzing project
Schemetic diagram

Steps to follow :


  1. Connect the Led by identifying the positive lead of led according to Fritzing image
  2. The resister if added good otherwise it is not necessary to put on resister because the current is limited to each pin of arduino boards.
  3. After this connect the board to PC by USB cable and then open up the IDE in PC.
  4. Goto File>Examples>01.Basics>blink
  5. The following Code will open.
  6.  
    Blink Code

    or
    Simply pastes this code in your file and upload this one.







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

     
    // Pin 13 has an LED connected on most Arduino boards.
    // give it a name:
    int led = 13;

    // the setup routine runs once when you press reset:
    void setup() {                
      // initialize the digital pin as an output.
      pinMode(led, OUTPUT);     
    }

    // the loop routine runs over and over again forever:
    void loop() {
      digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);               // wait for a second
      digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
      delay(1000);               // wait for a second
    }





  7. By clicking the new window will open in which the piece of code will be written.
  8. Check that your board is correctly selected and serial port is correct.
  9. Click on upload button and wait for code to get uploaded.
  10. After successful uploading of code the LED will start blinking automatically.
  11. Notice that every time you restart your Arduino Board the Led will automatically start blinking it self.

No comments:

Post a Comment