Introduction: How to Make a Relaxing Nightlight

About: Sometimes I make cool things but I always forget to post them here...
Yesterday, I got an Arduino Uno. This is I've wanted one for about a year (When I was in sixth grade) and I finally got one. The Arduino I was gifted came in a Makers Shed kit, which includes 7 LEDs, resistors, photo resistors, switches, etc. my friend and I made a sketch that made a tri-color LED switch colors every few seconds, along with LEDs that stay on the whole time and do not change their color. Only the tri-color LED requires any code, and it is very basic. I hope you like this, as it is my first Arduino project! This project really shows how much difference one LeD can make on a whole fixture.

Step 1: Materials

For this project you will need:

7x 270 ohm resistors
20x Jumper wires
1x blue LED
1x red LED
2x green LEDs
1x tri-color LED
1x Arduino
1x 9 volt battery case with DC plug
1x solderless breadboard

Step 2: The Fun Part

I know this is a very complicated way of doing things, but I can't draw the schematic with my tools right now.

The order is Analog0 to j30, a resistor from f30 to d30, and the left cathode on a30. GND to B29. A1 to j28, a resistor from f28 to d28. A2 to j27, a resistor from f27 to d27, to LED. This finishes the tri colored LED.

(For single colored LEDs) Powerstrip to j23, a resistor from f23 to d23, to the positive end of LED, GND to c22.

Repeat these steps for the other three LEDs, only plugging the 5V plug into the power strip. Do the same with the ground wire on the strip with the negative sign by it. Do the same procedure, just skipping about a space between the LEDs.

Step 3: The Other Fun Part (code)

This is the code that makes the tri color LED work. Just copy and paste.
int redPin = A0;
int greenPin = A1;
int bluePin = A2;

//uncomment this line if using a Common Anode LED
//#define COMMON_ANODE

void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}

void loop()
{
setColor(255, 0, 0); // red
delay(5000);
setColor(0, 255, 0); // green
delay(5000);
setColor(0, 0, 255); // blue
delay(5000);
setColor(255, 255, 0); // yellow
delay(5000);
setColor(80, 0, 80); // purple
delay(5000);
setColor(0, 255, 255); // aqua
delay(5000);
}

void setColor(int red, int green, int blue)
{
#ifdef COMMON_ANODE
red = 255 - red;
green = 255 - green;
blue = 255 - blue;
#endif
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);

}

Step 4: The Cover

Take a full sheet of paper, and cut it in half. Vertically roll the paper up, and staple it. This will tightly fit your LEDs. This will also make the colors shine in a more relaxing fashion.

Step 5: Connect It to a Power Source

Use a 9V battery pack or a wall plug for use in a bedroom by your bed.