< A Beginner's Arduino Guide < Projects

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
}
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.