Running a DC motor with PWM

You can do a digital write from 0 to 255 with some add delay() then repeat.
EX:

loop()
for (int x=1; x<256;x++)
{
// look at the digital write code & place here
// add some delay for the motor to move
}
// maybe some more delay to stop at 255 for a bit