If you are looking for code to make a sine wave, I did some experiments with PWM sine generation on an Arduino a couple of years ago.
https://wb8nbs.wordpress.com/2015/03/03/fun-with-direct-digital-synthesis/
https://wb8nbs.wordpress.com/2015/12/08/more-fun-with-direct-digital-synthesis-32u4-and-fast-pwm/
You probably don't need very many steps to drive a brushed motor.
https://wb8nbs.wordpress.com/2015/03/03/fun-with-direct-digital-synthesis/
https://wb8nbs.wordpress.com/2015/12/08/more-fun-with-direct-digital-synthesis-32u4-and-fast-pwm/
You probably don't need very many steps to drive a brushed motor.