2
8
DIR A
A digital signal to control the
rotation direction of motor A
(e.g., HIGH drives current
from output 4 to 3).
3
9
PWM A
A PWM signal to control the
speed of motor B. 0=off,
255=max speed.
4
7
DIR B
A digital signal to control the
rotation direction of motor A
(e.g., HIGH drives current
from output 2 to 1).
11
10
PWM B
A PWM signal to control the
speed of motor B. 0=off,
255=max speed.
While the Ardumoto Shield is attached to an Arduino, the used pins
shouldn’t be connected to anything else
.
Motor Outputs
Both of the L298’s motor driver outputs are broken out to the edge of the
shield. These 2-pin outputs are broken out to two footprints: a 3.5mm-pitch
screw terminal and a
0.1"-pitch header
. You can use either to wire up your
motor, but screw terminals make life much easier if you need to disconnect
your motor. The L298 is perfect for building simple two-wheel-drive robot
platforms — connect one motor to port A and the other motor to port B.
Technically, there is no right or wrong way to connect your motor’s wires to
the two output pins, but to help keep things straight, we suggest connecting
the red / black wire for each motor to pins 1 / 2 on port A and pins 3 / 4 on
port B, respectively.
The right and left motors of a robot spin different directions with the same
polarity drive because of the orientation. If you want to keep DIR
consistently moving that side of the bot “forward,” you may end up
swapping either the motor leads of one side or the logic in the code, but not
both. Play around with the leads of the motors on their respective sides and
watch the indicator LEDs to see the effect.
LED Indicators
Next to each of the motor outputs is a pair of blue and yellow LEDs, which
indicate the direction
your motor is spinning. These are great once you
get to debugging your project. They’re also useful if you want to test your
sketch without wiring up any motors.
Page 6 of 17