Motor Shield 1.0 Basic Sketch


I have a 12v motor that I need to control the speed on. I found the motor shield v1.0 at Radio Shack and thought I’d give it a try since I have an arduino already. I took a look at the basic demo sketch and I may need a bit of help. First off, I’m curious how many options you have for speed control via PWM and how do you control that speed? Once programmed, can the speed be changed without a computer? I could really use some help with this sketch.

One last question, I have another motor that is 3.3v, can that be controlled as well? They wouldn’t both be connected at the same time.

You can use any integer value from 0 to 255 to set the speed of the motor. 255 is 100% duty cycle or full speed. See the Motor_Shield_Demo_Code in wiki to see an example of forward reverse and stop for two motors. The line that sets the duty cycle is:
int spead=127;//define the spead of the motor
Yeah, I know the word speed is misspelled. Nevertheless, the value of 127 sets the speed at 50% duty cycle. You control the speed by changing that value then issuing a “analogWrite(speedpinA,spead);” (to use the demo code example). You might want to slow the motor as you approach a target or to make a gentle stop.
I don’t believe you could control the speed outside of program control. Well, theoretically you could put a MOSFET in series with the motor and slow the motor below the Arduino program’s duty cycle but you couldn’t speed it up faster than the program unless you have a fancy clocking circuit buffer, but that is too complicated to go into here.
I believe you can use the jumper pin to specify where you want to get your motor voltage supply – from the board or from an external source. Can someone verify?