Arduino Tutorials | Blinking led


In this blog we will learn about how to blink a led with arduino uno. 

 Components Required: 

  • 1 × Arduino board
  • 1 × Breadboard
  • 1 × Led
  • 1 × Resistor (220Ω)
  • 1 × Jumper wires (M)

 Circuit diagram: 

 Pin connection: 
1. Connect arduino digital 13 pin to 220ohm resistor and connect the resistor to led positive pin.
2. Connect arduino ground pin to led negative pin.
 Now Circuit is complete lets go to coding part.

Arduino Code

// the setup function runs once when you press reset or power the board
void setup() 

// the loop function runs repeatedly forever
void loop()
  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second

 Code explanation 

Initialize digital pin LED_BUILTIN (pin 13) as an output.
Note:- LED_BUILTIN is nothing but onboard led directly connects led to digital pin 13.

digitalWrite(13, HIGH);
It means to give 5v (HIGH) to pin 13. Here, the led will be on.

digitalWrite(13, LOW);
It means to give 0v (LOW) to pin 13. Here, the led will be off.

To wait for the program for 1000 milliseconds (1second) and then proceeding a program.

Note:-The led will on for 1 sec and then off for 1sec repeatedly.

Post a Comment


Post a Comment (0)