analogWrite(pin,value) requires pinMode(pin, OUTPUT);
added small bit of detail to digitalWrite() docs