I was playing around with the motor shield yesterday, but I was confused by the pin layout of the shield.
On the bottom right, there are the pins with screws to fasten the DC motors, but it is a bit unclear to me how to fasten a battery, and why there are so many other pins on the shield.
Does anyone have a pointer how to setup the motor shield with a small DC motor. For the sketch, I just would use analogWrite(...) to generate the PWM signal?
When you refer to "a" motor shield as "the" motor shield you make it sound as if there is only one make and model, which of course is not the case. It would be a good idea to identify it.....
I was playing around with the motor shield yesterday, but I was confused by the pin layout of the shield.
On the bottom right, there are the pins with screws to fasten the DC motors, but it is a bit unclear to me how to fasten a battery, and why there are so many other pins on the shield.
Bottom right of what? There are literally 1000's of different motor driver boards
out there that could be used, and dozens of Arduino shields to drive motors, many with
several versions/revisions.
...... and for all of them, there will (theoretically)be a datasheet and in many cases, sample Arduino code either from the makers or in the Playground
How about posting a link for the item in question when you have questions.
There are plenty of photos online with pin labels clearly visible. Have you looked at the schematic ?
const int AMDir = 12;
// AMDir: Digital direction (rotation sense) output pin assigned to the "A" motor. The pin assignment is not free, as the motor shield has the pins assigned (12: motor A; 13: motor "B". By convention, the forward movement HAS to correspond to the HIGH value in this pin; rewire if not)
const int AMotPWM = 3;
// AMotPWM: Digital output pin assigned to the "A" motor. The pin assignment is not free, as the motor shield has the pins assigned (3: PWM motor A; 11: PWM motor "B". Both signals are boosted by the board to the LSP1/2/3/4 terminals)
const int BMDir = 13;
const int BMotPWM = 11;