How to create a 38 Khz pulse with arduino using timer or PWM?

I would like to pulse width modulate a 38kHz carrier signal at 500hz, and adjust the duty cycle of the 500hz signal by reading a value from a potentiometer (value between 256 and 0 (100% to 0% duty cycle)).

Looks like I answered the wrong question. Give me a bit of time to do the correct answer ...