Breathing Night Light

Introduction: Breathing Night Light

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.

Step 1: LED Lights and the Arduino Board

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

Step 2: 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 } }

Step 3: 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.

Step 4: Materials

Arduino board

Led lights

Resistance

Wires

Shoebox

Plastic ball

Hotglue

Be the First to Share

    Recommendations

    • Anything Goes Contest

      Anything Goes Contest

    Comments