Setup and Loop

This example is for Wiring version 0024+. If you have a previous version, use the examples included with your software. If you see any errors or have comments, please let us know.

Loop.

The loop() function execute continuously. the setup() is only executed once. In this example the onboard LED blinks forever every two seconds

 
// The statements in the setup() function 
// execute once when the program begins
void setup() 
{
  pinMode(48, OUTPUT);  // Set pin 48 (onboard LED) to OUTPUT
}

// The statements in loop() are run until the 
// board is stopped. Each statement is run in 
// sequence and after the last line is read, the first 
// line is run again.
void loop() 
{ 
  digitalWrite(48, HIGH);
  delay(2000);
  digitalWrite(48, LOW);
  delay(2000);
}