newproyecto
Published © GPL3+

Bedside lamp lámpara de noche

If you are afraid of the dark this is the solution you are looking for Si tienes miedo a la oscuridad, esta es la solución que buscas

BeginnerFull instructions provided363
Bedside lamp lámpara de noche

Things used in this project

Hardware components

RGB Diffused Common Cathode
RGB Diffused Common Cathode
×1
Resistor 221 ohm
Resistor 221 ohm
×3
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Breadboard (generic)
Breadboard (generic)
Almost everything works
×1
Arduino UNO
Arduino UNO
×1

Software apps and online services

Arduino IDE
Arduino IDE
or
Arduino Web Editor
Arduino Web Editor

Story

Read more

Schematics

powerful_blorr_(3)_duu2YHxoxi.png

You can change the lighting using different resistors the higher the resistance, the lower the light and the lower the resistance the higher the light

Code

Light code for children

Arduino
int btn = 13;
void setup()
   {
pinMode(btn,INPUT);
   }
void Color(int r, int g, int b)
    {  
        analogWrite(9 , r) ;   // Red    - Rojo
        analogWrite(10, g) ;   // Green - Verde
        analogWrite(11, b) ;   // Blue - Azul
}
void loop(){ 
if (digitalRead(btn)==HIGH){
Color(128,255,255); 
delay(300000);
Color(0,255,255); 
delay(300000);
Color(0,64,128); 
delay(300000);
Color(0,0,255); 
delay(300000);
Color(0,0,128); 
delay(300000);
Color(0,0,64); 
delay(300000);
}  
else{
}
}

Light code for girls

Arduino
int btn = 13;
void setup()
   {
pinMode(btn,INPUT);
   }
void Color(int r, int g, int b)
    {  
        analogWrite(9 , r) ;   // Red    - Rojo
        analogWrite(10, g) ;   // Green - Verde
        analogWrite(11, b) ;   // Blue - Azul
}
void loop(){ 
if (digitalRead(btn)==HIGH){
Color(255,128,255); 
delay(300750);
Color(255,128,192); 
delay(300750);
Color(255,0,255); 
delay(300750);
Color(255,0,192); 
delay(300750);
Color(128,0,64); 
delay(300750);
Color(128,0,128); 
delay(300750);
Color(64,0,64); 
delay(300750);
Color(64,0,128); 
delay(300750); 
} 
else{
}
}

Credits

newproyecto
3 projects • 4 followers
Hello everyone, my name is Antonio and I love programming and doing projects with Arduino and I hope these projects will help you.
Contact

Comments

Please log in or sign up to comment.