SetupLoop \ Learning \ Wiring ALPHA 1.0
Author: Hernando Barragán
Description: Wiring is an electronic sketchbook and hardware electronics for developing ideas. It is a context for learning fundamentals of computer programming and prototyping with electronics within the context of the electronic arts.
Keywords: Wiring, Processing, Interactive Media, Electronic Arts, Programming, C, C++, Hernando Barragán

Search wiring.org.co:

This example is for Wiring version 0023+. 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(48, OUTPUT);  // Set the pin 48 (onboard LED) as OUTPUT
      digitalWrite(48, HIGH);     // Set the pin 48 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(48, LOW);
        delay(100);
        digitalWrite(48, HIGH);
        delay(100);
      }
      y = y - 1;
    }