Making Furniture Interactive

September 4, 2007

Tae’s Exercise 0

Filed under: Exercise 0: Make A Lamp — architk @ 8:57 pm

This was a fun exercise overall even though I struggled at first in the process with no previous experience in programming or electricity. I tried to design a lamp with three lights going in a sequence that would mimic traffic light of startline at a racing game. I made first two lights to blink briefly with less delay and then the last light to fade in and out gradually signing “GO”.

3 lightsgo

I used three LEDs (Red, Blue, Green), wires, breadboard, 3 resistors, Arduino board, and translucent paper. The trick was how to make the two first lights to blink and then make the last one light to fade in and out. I copied examples from Arduino software and modified blinking and fading codes to get a result I want. I played with numbers and changed delay time and blinking intervals. There were lots of syntax errors but eventually succeeded in uploading. I assigned PinRed, PinGreen, PinBlue not to get confused. I used pin number 5, 8, 13. LEDs got power from the pin sources mentioned and moved through resistors and looped back to the ground wire. The loop repeated over and over.

wiringwiring

I made a lamp cover out of translucent paper which I cross folded 4 times to create an umbrella shape. Then I pierced extra LED light to give some kind of structure under the paper and also create a neat tip. Then I put it over the three glowing lights. The diffused light turned out to be pretty nice.

lamp cover

Code

int value = 0;
int ledPingreen = 13; // LED connected to digital pin 13
int ledPinblue = 8; // LED connected to digital pin 8
int ledPinred = 5; // LED connected to digital pin 5
void setup() // run once, when the sketch starts
{
pinMode(ledPingreen, OUTPUT); // sets the digital pin as output
pinMode(ledPinblue, OUTPUT); // sets the digital pin as output

}

void loop() // run over and over again
{
{
digitalWrite(ledPingreen, HIGH); // sets the LED on
delay(250); // waits for a second
digitalWrite(ledPingreen, LOW); // sets the LED off
delay(50); // waits for a second
digitalWrite(ledPinblue, HIGH); // sets the LED on
delay(250); // waits for a second
digitalWrite(ledPinblue, LOW); // sets the LED off
delay(50); // waits for a second
}
for(value = 0 ; value <= 255; value+=5) // fade in (from min to max)
{
analogWrite(ledPinred, value); // sets the value (range from 0 to 255)
delay(15); // waits for 30 milli seconds to see the
dimming effect
}
for(value = 255; value >=0; value-=5) // fade out (from max to min)
{
analogWrite(ledPinred, value);
delay(15);
}
}

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

Blog at WordPress.com.

%d bloggers like this: