How to Fade an LED - Arduino Tutorial: In this example you will learn how to fade an LED by using analogWrite() function. AnalogWrite uses pulse width modulation (PWM), turning a digital pin on and off very quickly, to create a fading effect. Before we start let's learn more about PWM