Uploaded August 2011 | Updated September 2026, 2 weeks ago
Arduino uno with a button and 6 leds with the fade effect. When turn of the leds turn off in order.
Thank you for watching!
Check Out My Website for more projects and tutorials!
nothingtosomethingtutorials.blogspot.com
SOURCE CODE
/*This is my attemp to make an illusion of fire.
or an illusion of the leds moving with the win.
*/
int thr=5; //b represents brightness for pin
int fiv=50;
int six=100;
int nin=150;
int ten=205;
int ele=255;
int buttonpress=0;//button press or not
int c1=5; //c represents change
int c2=5;
int c3=5;
int c4=5;
int c5=5;
int c6=5;
void setup(){
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(A0,INPUT);
}
void loop(){
buttonpress = digitalRead(A0);
if(buttonpress==HIGH){
analogWrite(3,thr);
thr=thr-c1;
analogWrite(5,fiv);
fiv=fiv-c2;
analogWrite(6,six);
six=six-c3;
analogWrite(9,nin);
nin=nin-c4;
analogWrite(10,ten);
ten=ten-c5;
analogWrite(11,ele);
ele=ele-c6;
if(thr==0 || thr==255){
c1=-c1;
}
if(fiv==0 || fiv==255){
c2=-c2;
}
if(six==0 || six==255){
c3=-c3;
}
if(nin==0 || nin==255){
c4=-c4;
}
if(ten==0 || ten==255){
c5=-c5;
}
if(ele==0 || ele==255){
c6=-c6;
}
delay(10);
}
else{
digitalWrite(3,LOW);
delay(60);
digitalWrite(5,LOW);
delay(60);
digitalWrite(6,LOW);
delay(60);
digitalWrite(9,LOW);
delay(60);
digitalWrite(10,LOW);
delay(60);
digitalWrite(11,LOW);
delay(60);
}
}
Arduino uno with a button and 6 leds with the fade effect. When turn of the leds turn off in order.
Thank you for watching!
Check Out My Website for more projects and tutorials!
nothingtosomethingtutorials.blogspot.com
SOURCE CODE
/*This is my attemp to make an illusion of fire.
or an illusion of the leds moving with the win.
*/
int thr=5; //b represents brightness for pin
int fiv=50;
int six=100;
int nin=150;
int ten=205;
int ele=255;
int buttonpress=0;//button press or not
int c1=5; //c represents change
int c2=5;
int c3=5;
int c4=5;
int c5=5;
int c6=5;
void setup(){
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(A0,INPUT);
}
void loop(){
buttonpress = digitalRead(A0);
if(buttonpress==HIGH){
analogWrite(3,thr);
thr=thr-c1;
analogWrite(5,fiv);
fiv=fiv-c2;
analogWrite(6,six);
six=six-c3;
analogWrite(9,nin);
nin=nin-c4;
analogWrite(10,ten);
ten=ten-c5;
analogWrite(11,ele);
ele=ele-c6;
if(thr==0 || thr==255){
c1=-c1;
}
if(fiv==0 || fiv==255){
c2=-c2;
}
if(six==0 || six==255){
c3=-c3;
}
if(nin==0 || nin==255){
c4=-c4;
}
if(ten==0 || ten==255){
c5=-c5;
}
if(ele==0 || ele==255){
c6=-c6;
}
delay(10);
}
else{
digitalWrite(3,LOW);
delay(60);
digitalWrite(5,LOW);
delay(60);
digitalWrite(6,LOW);
delay(60);
digitalWrite(9,LOW);
delay(60);
digitalWrite(10,LOW);
delay(60);
digitalWrite(11,LOW);
delay(60);
}
}










