Arduino Color Mixing Light

1,401

16

1

Published

Introduction: Arduino Color Mixing Light

Have you got a night light ? Have you ever been bored of it ? This light changes color so you never get bored of it.

Step 1: Parts

You will need :
Arduino
Cables
3 LEDs
Cardboard
Breadboard
Rice paper

Step 2: Build the Circuit

Place the breadboard on top of the arduino so that you can see the pins.Then put the LEDs on the pins 9,10,11.

Step 3: Cut the Cardboard

Cut 5 pieces:
1 piece 10x7
2 pieces 8x5
2 pieces 6,5x5
On one of the small pieces cut a square so you can connect the cable.
Then glue the pieces together.

Step 4: The Code

int fadeAmount2 = 5;
int brightness2 = 0;
int led = 11;
int led1 = 10;
int led2 = 9;
int brightness = 0;
int fadeAmount = 5;
int brightness1 = 0;
int fadeAmount1 = 5;
void setup(){
pinMode(led, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT); }
void loop(){
analogWrite(led, brightness);
brightness = brightness + fadeAmount;
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
brightness = brightness -200; }
delay(20);
analogWrite(led1, brightness1);
brightness1 = brightness1 + fadeAmount1;
if (brightness1 == 0 || brightness1 == 255) {
fadeAmount1 = -fadeAmount1 ;
brightness1 = brightness1 + fadeAmount1; }
delay(20);
analogWrite(led2, brightness2);
brightness2 = brightness2 + fadeAmount2;
if (brightness2 == 0 || brightness2 == 255) {
fadeAmount2 = -fadeAmount2 ;
} delay(20);}

Step 5: The Ending

Place the arduino in the cardboard box. Then place rice paper on the box.

Share

    Recommendations

    • Make it Move Contest

      Make it Move Contest
    • Clocks Contest

      Clocks Contest
    • Casting Contest

      Casting Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments

    Pretty cool, thanks for sharing!

    If you wanted there are various simulators you can use to draw up wiring diagrams. That would be cool if you included something like that. Just a thought! ;)