Fading using an Arduino

Demonstrates the use of analog output (Pulse Width Modulation (PWM)) to fade an LED. PWM is a technique for getting an analog-like behavior from a digital output by switching it off and on very fast.

Fading using an Arduino


An LED connected to digital output pin 9 through a 220-ohm resistor.


image developed using Fritzing. For more circuit examples, see the Fritzing project page

Fading using an Arduino schematic



This example shows how to fade an LED using the analogWrite() function.
The circuit:
* LED attached from digital pin 9 to ground.
Created 1 Nov 2008
By David A. Mellis
modified 30 Aug 2011
By Tom Igoe
This example code is in the public domain.

int ledPin = 9;    // LED connected to digital pin 9
void setup()  {
// nothing happens in setup


Major Components in Project


For more detail: Fading using an Arduino

This Post / Project can also be found using search terms:

  • https://duino4projects com/fading-using-an-arduino/

Leave a Comment

= 4 + 7

(Spamcheck Enabled)

Read previous post:
Build Temperature & Humidity & Smoke Detector Alarm System Based on Arduino

Project Summary: Build temperature & humidity & smoke alarm system based on ICStation Mega 2560 compatible with Arduino( Cost is...

Scroll to top