Making Furniture Interactive

September 4, 2007

tom’s exercise 0

Filed under: Exercise 0: Make A Lamp — tomrgon @ 8:13 am

09-05-07_2154.jpg09-05-07_2153.jpgcorrect one
i messed around with switching up digital and analog write commands to try and mix up alternating fade/blink programming, and tweaked the timing until i got something that alternates combinations of lights regularly, presumably changing the color of the lamp as a whole (though i found the blue led to be much brighter than the other two, so the lamp’s mostly blue).  then i got an ikea food-warmer with holes in it, and put paper over the holes to diffuse the light, and that’s my lamp.  the lighting pattern isn’t quite as random as i’d wanted, but i couldn’t figure out how to do it without screwing with the existing pattern.  i have yet to figure out how to link in a txt file, so for the sake of getting code up, here it is:  <int VALUE = 0;int REDLEDPIN = 11;int GREENLEDPIN = 9;int BLUELEDPIN = 10;
void setup(){  pinMode(REDLEDPIN, OUTPUT);  pinMode(GREENLEDPIN, OUTPUT);  pinMode(BLUELEDPIN, OUTPUT);}
void loop(){  for(VALUE=0; VALUE <=255; VALUE+=5)  {    analogWrite(BLUELEDPIN, VALUE);    delay(10);  }  for(VALUE=0; VALUE <=255; VALUE+=5)  {    analogWrite(REDLEDPIN, VALUE);    delay(30);  }  for(VALUE=0; VALUE <=255; VALUE+=5)  {    analogWrite(GREENLEDPIN, VALUE);    delay(20);  }    for(VALUE = 255; VALUE >=0; VALUE-=5)  {    analogWrite(REDLEDPIN, VALUE);    delay(10);  }   for(VALUE = 255; VALUE >=0; VALUE-=5)  {    analogWrite(BLUELEDPIN, VALUE);    delay(20);  }   for(VALUE = 255; VALUE >=0; VALUE-=5)  {    analogWrite(GREENLEDPIN, VALUE);    delay(30);  }}>

Advertisements

1 Comment »

  1. yes, we’ll work on a scheme for posting code. How about posting a picture, though or two, of your lamp – and even a video?

    Comment by mdgross — September 5, 2007 @ 6:01 pm | Reply


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: