I am starting a new project that interfaces an Arduino Mega with a Pololu md03a motor driver which is then wired to a dc motor. The connections of importance on the motor driver are the enable pin, the two select lines - inA and inB, and the PWM pin. I understand the enable pin enables/disables use of the motor and that the inA and inB lines are used to select which direction the motor spins. The only part I am unsure about is the PWM pin and how I go about writing software to feed it a PWM signal from the Mega. Please help!
Use one of the pins identified as a PWM pin, and use analogWrite(pinNumber, dutyCycle); to write to the pin. dutyCycle is a value between 0 and 255.
Have a look at this for information on how PWM works:- http://www.thebox.myzen.co.uk/Tutorial/PWM.html