Statements and comments

This example is for Wiring version 1.0 build 0100+. 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.

Setup and Loop.

The loop() function creates a structure in which to write programs that change with time.

// The statements in the setup() function
// execute once when the program begins
void setup()
  pinMode(WLED, OUTPUT); // Set the pin WLED (onboard LED) as OUTPUT
  digitalWrite(WLED, HIGH); // Set the pin WLED as HIGH (turn ON the onboard LED)

int y = 100;

// The statements in loop() are executed until the
// board is stopped. Each statement is executed in
// sequence and after the last line is read, the first
// line is executed again.
void loop()
  if (y > 0)   // Blink the LED while y > 0
    digitalWrite(WLED, LOW);
    digitalWrite(WLED, HIGH);
  y = y - 1;