Arduino | Project 2 – Fade LED

Project – Fade LED diode

Output –

Source code-

int led = 9;
int brightness = 0;
int fadeAmount = 5;
//setup routine runs once when you press reset:
void setup(){
pinMode(led, OUTPUT);
}

void loop() {
analogWrite(led, brightness);
brightness = brightness + fadeAmount;
if (brightness == 255 || brightness == 255)
{
fadeAmount = -fadeAmount;
}
delay(20);
}

Advertisements

About Jaggi
love technology, always updated on the latest and current happenings, seminars, tech.Ed, virtual days! Be Yourself!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: