Fade 2 leds w/ pontentiometer Arduino Uno @withcheesepls
Fade 2 leds w/ pontentiometer Arduino Uno  @withcheesepls
Uploaded August 2011 | Updated September 2026, 2 weeks ago
Source Code



/* This source is for fading 2 leds one at a time
As soon as one led is off the other will start to turn on
I added a pontentiometer to change the daly time. it makes it more interesting
*/


int brightness=0; //sets the brightness of the led. it starts as off or 0
int change = 5; //change for bightness
int ledon = 6; // ledon is the led which is currently on
int ledchange = 1; // switches which led is going to turn on
int prevled =5; // represents the previous led that was on.
int val; // value for delay
void setup()
{
pinMode(5,OUTPUT); //led is on pin 5
pinMode(6,OUTPUT); // anothe led on pin 6
pinMode (2,INPUT); //pontentiometer is in pin 2
}

void loop()
{
val = analogRead(2); //sets the integer(val) as what the pontentiometer is set to.

analogWrite(ledon, brightness); // starts to set the led on
brightness = brightness + change; // creates the fade effect

if (brightness == 255){ //if brightness reaches 255 then
change=-change; // change will become negative and cause led to fade out
ledchange=-ledchange; //this will switch which led is on
}

if (brightness == 0){ //if brightness is 0 or nothing then
ledon =ledchange+ledon; //led which will turn on is changed
prevled =ledon - ledchange; //SETs the led which was previously on so
analogWrite(prevled,0); // it will stay off without this the led will stay on
change=-change; // chage changes again to fade the led up.
}


delay(val); //delay is set by potentiometer
}
Fade 2 leds w/ pontentiometer Arduino UnoA java Game for class project /w source codeArduino uno fade response to Hello World! With SourceI made: simple portfolio design (Timelapse, HTML, CSS)Flying cockroach ! Creepy!Time lapse shot in 2k ultra HD from Nexus 5xAnother fire effect on arduinoFade 3 LEDs arduinoBoredomSony VAIO motherboard for sale eBay. With pentium 4 cpu. AnPontentiometer + led + fade on arduino unoArduino
withcheesepls |

Fade 2 leds w/ pontentiometer Arduino Uno

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER