The "Fade" example that comes with the Arduino IDE shows how to use PWM.
The Arduino command to produce a PWM output is analogWrite(vvv) analogWrite(pin, vvv) where vvv is a number between 0 and 255 that defines the duty cycle.
There will also be information in the website Reference section.
...R
Edit to correct error.