And, besides your code, we need information on your hardware and how it is wired. Post data sheets for the motor, motor driver and motor power supply.
Post a schematic of your wiring. See here for how to make and post a schematic.
What Arduino board?