code at -> examples/analog/Fading.ino
Important note: semicolons are not optional in arduino.
This is our first example that writes an analog value. Where digital is either on or off, high or low, analog has more granularity. It is used for things when you want varying values, like fading an LED.
The range of analog write is 0 - 255
Some good information from arduino on PWM.
A way to get analog results with digital means. A square wave is created and modulated at a certain tempo to get an analog effect.
Using the value of analogRead as wait time between analogWrite high and low. This makes the LED blink fast or slow.