CNAP
03 / Templates · beginner

The Hello World of Arduino. Blinks an external red LED on pin 13 on and off every second.

beginnerLEDdigital output
Circuit
Code
sketch.inoArduino C++
16 lines
// LED Blink — wire a red LED + 220Ω resistor to pin 13 and GND.

const int LED_PIN = 13;

void setup() {
  pinMode(LED_PIN, OUTPUT);
  Serial.begin(9600);
  Serial.println("Blink started!");
}

void loop() {
  digitalWrite(LED_PIN, HIGH);  // turn LED on
  delay(1000);                   // wait 1 second
  digitalWrite(LED_PIN, LOW);   // turn LED off
  delay(1000);                   // wait 1 second
}
Components
  • Arduino Uno
    01
  • LED (red)
    02
  • Resistor 220Ω
    03
Wiring
Component PinArduino Pin
Resistor Pin 1Pin 13
LED Anode (+)Resistor Pin 2
LED Cathode (−)GND