Go Down

Topic: Heart Mood Light (Read 1 time) previous topic - next topic


This is my heart mood light, i have two LED lights a blue and red one. They fad from on and off at different times to switch up the colors and make purple at once. I used the Arduino to create this and just a simple plastic heart.

Video of the heart in action - http://www.youtube.com/watch?v=0ehsETNgHxw


Code: [Select]
int rPin = 5;
int bPin = 3;
int rVal = 0;

void setup(){
  pinMode(rPin, OUTPUT);
pinMode(bPin, OUTPUT);


void loop(){
  // Fade on
for(int i=0; i<255; i++){
   analogWrite(rPin, i);
   analogWrite(bPin, abs(255-i));

//Fade off
for(int i=0; i<255; i++){
   analogWrite(rPin,abs(255-i) );
  if(cnt < 255){
     analogWrite(rPin, cnt);
     analogWrite(bPin, abs(255-cnt));
     cnt = cnt+1;
  } else if (cnt > 0){
     analogWrite(rPin, abs(255-cnt));
     analogWrite(bPin, cnt);
     cnt = cnt-1;


looks great!  how did you get the hear to "glow" light that?  what did you use to diffuse the light within the plastic heart or did you buy it like that?


Go Up