Shifting code from PICAXE to Arduino

analogWrite to a non-PWM pin isn't recommended.

Use of code tags when posting code is.