User login

Powered by Drupal, an open source content management system

Theory and Practice of Tangible User Interfaces

Blinking LED

Submitted by npdoty on Wed, 09/10/2008 - 23:53

Assignment: Introduction to Arduino and Physical Computing

Collaborators:

As described by directions, the Arduino was set up to intermittently set pin 13 to high and low and pin 13 was passed through a 220 ohm resistor and a light-emitting diode (and then back to ground).

Changing the timing in the Arduino code changes how fast the light blinks.

Arduino Code

/*
 * Blink
 *
 * The basic Arduino example.  Turns on an LED on for one second,
 * then off for one second, and so on...   
*
 * http://www.arduino.cc/en/Tutorial/Blink
 */

int ledPin = 13;                // LED connected to digital pin 13

void setup()                    // run once, when the sketch starts
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

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