Why doesn't pin 3 blink? It blinks in another program
In the tone function reference you can read:


  Use of the tone() function will interfere with PWM output on pins 3 and 11 (on boards other than the Mega).


analogWrite() is PWM