Arduino Blinking LED Code

This example (Arduino Blinking LED Code) uses the built-in LED that most Arduino and Genuino boards have. This LED is connected to a digital pin and its number may vary from board type to board type. You Can just Copy this code and paste it in arduino software see my video for detail.

If you want to lit an external LED with this sketch, you need to build this circuit, where you connect one end of the resistor to the output digital pin. Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the GND. In the diagram below we show an UNO board that has D13 as the output pin.

The value of the resistor in series with the LED may be of a different value than 220 ohm; the LED will lit up also with values up to 1K ohm.

arduino Blinking LED Code

Arduino Blinking LED Code

void setup() {
  pinMode(13,OUTPUT);
 

}

void loop() {
  digitalWrite(13,HIGH);
  delay(1000);
  digitalWrite(13,LOW);
  delay(1000);
 

}

Close Menu