Re: Motor Shield on the Arduino MEGA 2560
I too am experiencing the identical symptoms referenced by the original poster (lt.surge). I have an Arduino Mega 2560 Rev 2, and an Adafruit V1.0 Motor Shield, using IDE 1.0.1, and the Motor Shield library downloaded from the GitHub website within the past few days. Instead of motors, I connected back-to-back LEDs to each port, plus a resistor in series with each LED to limit current. LEDs were wired in both directions across each motor port so I could visually see a "high" signal, and its polarity.
Using the sample "Tick Tock" code, port M1 worked in both directions. None of the other three ports functioned in either direction. I then modified the tick-tock program to drive all four ports at the same time for troubleshooting purposes.
A quick bit of diagnostic work while the "tick-tock" program was running showed IC1-1 ("1-2 ENABLE") enabled (high, 4.8Vdc), but not any of the other "Enable" ports (IC1-9, "3-4EN"), (IC2-1, "1-2EN"), or IC2-9, "3-4EN"). The ENABLE pins for each of the non-functioning ports' ENABLE pins showed approximately 2.0 Vdc on them, which would lead me to believe the Mega 2560 ports connected to the respective Motor Shield ENABLE pins were likely tri-stated in a high-Z condition.
After modifying the "tick-tock" program motor initialization code as suggested by lt.surge, all four ports are functional to the extent they illuminate my LED "motors" correctly.
AF_DCMotor motor1(1, MOTOR12_1KHZ); // create motor #1, 64KHz pwm
AF_DCMotor motor2(2, MOTOR12_1KHZ); // create motor #2, 64KHZ pwm
AF_DCMotor motor3(3, MOTOR12_1KHZ); // create motor #3, 64KHZ pwm
AF_DCMotor motor4(4, MOTOR12_1KHZ); // create motor #4, 64KHZ pwm
AF_DCMotor motor1(1); // create motor #1
AF_DCMotor motor2(2); // create motor #2
AF_DCMotor motor3(3); // create motor #3
AF_DCMotor motor4(4); // create motor #4
... worked. All four ports now light the LEDs and change the direction of polarity per my program.
I've not yet done any testing involving changing the PWM duty cycle or frequency. That's next.
It appears there's something different about the Mega 2560 that doesn't like the way the Motor Shield library code attempts to initialize the motors.
Still more diagnostic work to do .. but at least all four ports are now functioning to some extent.