A Beginner's Arduino Guide/Projects/Getting the LED to flash

In this chapter, you will learn how to get the LED to flash on an Arduino board. This is one of the simplest projects that you can undertake.

// this runs only once on power up
void setup() {
  pinMode(13, OUTPUT);
}

// the loop function runs continuously until the device is powered down
void loop() {
  digitalWrite(13, HIGH);   // turn on LED
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn off LED
  delay(1000);              // wait for a second
}