LED blinky: first code in Arduino

Objective:

Make an LED blink at different time interval using Arduino

Resources needed

SNo Component Quantity
1 Arduino uno 1
2 LED 1
3 Jumper wire 2
4 Breadboard 1

Fritzing:

cod screen shot

Code:

void setup() {
pinMode(4, OUTPUT);
}
void loop() {
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(4, LOW);
delay(1000);
}

Below is the copy of working code

cod screen shot

Code Explanation

We setup our digital pin 4 as output pin under our void setup() function.Our LED is connected to digital pin 4. Under our void loop() function we switch our digital pin between high and low using digitalWrite(); function. we create a delay between the switch using delay(); function.