Breathing Night Light

by Coochie Man in Living > Kids

232 Views, 2 Favorites, 0 Comments

Breathing Night Light

all-800-1_f900e4d4-2be1-4211-ab1f-55ecdee28477_1000x.jpg

Some kids are afraid of darkness, this little breathing night lamp can let their breaths follow the patterns of the light so they can go asleep more easily.

LED Lights and the Arduino Board

image21.png

Connect 1 group of LED lights, put the Dpin on the PWM signal pin.

The Code

Here's the code:

int _brghtness ;

int _brightness ;

void setup(){ // put your setup code here, to run once: _brghtness = 0 ;

}

void loop(){ // put your main code here, to run repeatedly: for (int j = 0 ; j < 255 ; ++j ) { _brightness = ( _brghtness + 0 ) ; analogWrite(6 , _brightness); //analogWrite values from 0 to 255 delay( 50 ); // waits a few milliseconds } delay( 2000 ); // waits a few milliseconds for (int i = 0 ; i < 255 ; ++i ) { _brightness = ( _brghtness - 0 ) ; analogWrite(6 , _brightness); //analogWrite values from 0 to 255 delay( 50 ); // waits a few milliseconds } }

The Outside Look

Use a simple shoebox to cover the Arduino board, I made a little ball out of plastic for the out side of the LED lights so it became a cute little lamp.

Materials

Arduino board

Led lights

Resistance

Wires

Shoebox

Plastic ball

Hotglue