It took me ages to discover this, but it is mentioned in the manual.
analogRead has nothing to do with analogWrite.
analogWrite can be used on any PWM pin (digital pins 3, 5, 6, 9, 10, and 11) and creates a PWM wave.
a PWM wave is a square-shaped wave that can be read using pulseIn.
analogRead reads a voltage from the analog pins only.
When it reads a voltage of between 0V and 5V, it will return an integer value of between 0 and 1023. (where
5V corresponds to 1023, obviously).
Personally, I've yet to find a wonderful use for this. If you have a great example, then please do leave the
details below.
The analog pins can be used in the same way as digital pins for both output and input, which I find much more useful.