.... you meed (sic) to clarify whether you have a DC motor or a servo.
And if it's a dc motor and you have code for a dc motor, you can't reasonably expect help when you post servo code. Anyone trying to help is really pissing in the dark if you don't provide enough info.
It seems that you have posted servo code for a dc motor and have given a link to a schematic that you believe you followed correctly, but with a few differences. Post the actual code and the actual schematic, maybe with photos or Fritzings
, then you'll probably get some help....