Making Furniture Interactive

September 11, 2007

Dan D.W. Kang Assignment Two: Part Two- Flood Warning System

Filed under: Dong Woo Kang,Exercise 2: Add a Switch — dwkang @ 3:55 pm

Part Two:

* Description:

For the second part of the assignment, I designed a “flood warning system.” This system will detect the amount of the rainfall and send out a warning signal if the water level gets too high. This system actually uses “water” to switch on the warning system. The signals only use the red LEDs to effectively deliver the message of “warning.” Three small LEDs will blink each time consecutively, then the large LED in the center will flicker. You can watch the video clip to see how it works.

http://www.youtube.com/watch?v=z__2tJGuz4k

dscn0562.jpg

dscn0568.jpg

dscn0570.jpg

 * Code:

The four different blinking LEDs use simple blink programming code. “Delay” value is 300 for the small LEDs and 80 for the big LED. The blink programming for the big LED is duplicated 8 times to create a flickering effect.

  

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

int LED2 = 12;              //LED connected to digital pin 12

int LED3 = 11;               //LED connected to digital pin 11

int BIGLED = 10;               //LED connected to digital pin 10

void setup()                    // run once, when the sketch starts

{

  pinMode(LED1, OUTPUT);      // sets the digital pin as output

  pinMode(LED2, OUTPUT);    // sets the digital pin as output

  pinMode(LED3, OUTPUT);

  pinMode(BIGLED, OUTPUT);

}

void loop()                     // run over and over again

{

  {

  digitalWrite(LED1, HIGH);   // sets the LED on

  delay(300);                  // waits for a second

  digitalWrite(LED1, LOW);    // sets the LED off

  delay(300);                  // waits for a second

  }

  {

  digitalWrite(LED2, HIGH);   // sets the LED on

  delay(300);                  // waits for a second

  digitalWrite(LED2, LOW);    // sets the LED off

  delay(300);                  // waits for a second

  }

  {

  digitalWrite(LED3, HIGH);   // sets the LED on

  delay(300);                  // waits for a second

  digitalWrite(LED3, LOW);    // sets the LED off

  delay(300);                  // waits for a second

  }

  {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(300);                  // waits for a second

  }

}

   

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: