LM317 Help

Maybe even some example code

analogWrite(pin, value);

Schematic(s)

use the PWM output filtered and into the gate
http://www.thebox.myzen.co.uk/Tutorial/PWM.html