Examples

| Blinking LED by BARRAGAN <http://barraganstudio.com> turns on and off light (LED) connected to a digital pin, with intervals of 1 second (1000 milliseconds) Note in the circuit the LED it has a positive (long leg) and a ground (short leg), if the LED doesn't turn ON, it might be it is inverted. Created 2 December 2003 Revised 1 May 2007 |

    // Blinking LED
    // by BARRAGAN <http://barraganstudio.com>

    int ledPin = 0;           // LED connected to the Wiring I/O board pin 0

    void setup()
    {
      pinMode(ledPin, OUTPUT); // sets the digital pin as output
    }

    void loop()
    {
      digitalWrite(ledPin, HIGH);   // sets the LED on
      delay(1000);                  // waits for a second
      digitalWrite(ledPin, LOW);    // sets the LED off
      delay(1000);
    }