User login

Powered by Drupal, an open source content management system

Theory and Practice of Tangible User Interfaces

Blinking LED project

Submitted by naryasece on Wed, 09/10/2008 - 17:08

Assignment: Introduction to Arduino and Physical Computing

Collaborators:

In this project, I first made one LED blink, then I got two LEDs to blink alternatively

 

I used:

 

  • 2 Light Emitting Diodes
  • 1 220-ohm Resister,
  • Arduino Board
  • Breadboard
  • 4 wires

 

The Source Code, modified to blink two LED's attached to outputs 12 and 13

 

/*
 * Blink
 *
 * The basic Arduino example.  Turns on an LED on for one second,
 * then off for one second, and so on...  We use pin 13 because,
 * depending on your Arduino board, it has either a built-in LED
 * or a built-in resistor so that you need only an LED.
 *
 * http://www.arduino.cc/en/Tutorial/Blink
 */

int ledPinBlue = 13;// LED connected to digital pin 13
int ledPin = 12; //LED connected to Digital pin 12

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

void loop()                     // run over and over again
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(500);                  // waits for 1/2 seconds
  digitalWrite(ledPin, LOW);    // sets the LED off
  //delay(500);                  // waits for 1/2 second
  digitalWrite(ledPinBlue, HIGH);
  delay(500);
  digitalWrite(ledPinBlue, LOW);
  //delay(500);
}