How to Blink an led with Arduino



Material you would need -

1. a LED
2. Arduino
3. Arduino IDE (to program Arduino) 
    download it from here -Arduino IDE

Step 1 - 
Upload the program written below in Arduino with Arduino IDE.
        
// 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
}



Step 2 - 
After uploading disconnect your arduino from usb port and 
connect positive of  led to a terminal of resistor and connect
second terminal of resistor to pin 13 and ground to ground                   
pin on arduino. 
             
                                                 circuit is illustrated below.

Step 3 - 
Now check your circuit and connect your arduino to usb port of pc. if you did everything correct your arduino would blink for a second and after a second it would  be off  for 1 second this would continue because we added a loop. now try to control more than one led by yourself.



















No comments:

Post a Comment