Introduction: Arduino Mood Lamp

Hello Instructables Users!!! This is a simple, fun, and useful project for arduino beginners. You will be building the lamp and then uploading the code to make the lamp light up to a color of your liking. The color is smooth and lights up the area of your room you put it in.

Step 1: Step 1: Needed Parts

These are the parts needed to build the lamp:

1.) Jumper wires

2.) 120k Ohm resistor

3.) The LED color of your choice

4.) LDR (photo light resistor)

5.) Arduino Uno

6.) Breadboard

Step 2: Step 2: Building the Lamp

The following photo above is a schematic to build your mood lamp

Step 3: Step 3: Coding the Arduino

Copy and Paste the following code to use for your lamp:

void setup(){
pinMode(redLed,OUTPUT); pinMode(greenLed,OUTPUT); pinMode(blueLed,OUTPUT); digitalWrite(redLed,HIGH); digitalWrite(greenLed,LOW); digitalWrite(blueLed,LOW); }

void loop(){ for (int y=0; y<=3; y++) { if (y=1){ for (int x=0;x<=255;x++){ RGB[0]=255-x; RGB[1]=0; RGB[2]=0+x; analogWrite(redLed,RGB[0]); analogWrite(greenLed,RGB[1]); analogWrite(blueLed,RGB[2]); delay(delaymood); } } if (y=2){ for (int x=0;x<=255;x++){ RGB[0]=0; RGB[1]=0+x; RGB[2]=255-x; analogWrite(redLed,RGB[0]); analogWrite(greenLed,RGB[1]); analogWrite(blueLed,RGB[2]); delay(delaymood); } } if (y=3){ for (int x=0;x<=255;x++){ RGB[0]=0+x; RGB[1]=255-x; RGB[2]=0; analogWrite(redLed,RGB[0]); analogWrite(greenLed,RGB[1]); analogWrite(blueLed,RGB[2]); delay(delaymood); } } } }

Step 4: Step 4: Final Result

The final outcome of the lamp is a smooth color added to your room for light!

Comments

author
You_know_me made it!(author)2016-10-31

Can you please describe a bit more about how you made that tall lamp shade of yours ? It looks rather interesting!

author
seamster made it!(author)2016-05-13

Looks good! :)

About This Instructable

1,466views

9favorites

More by EddyL00:Arduino Mood Lamp
Add instructable to: