I am trying to make an "OSEPP Motor and Servo Shield" and a Mega2560 drive 4 DC motors using Adafruit Motor Shield Library 'V1' (as that is what the shield calls for). I have the shield stacked and I can drive any ONE of the FOUR motors using the appropriate output (M1-M4), BUT I can not get more than ONE to work at a time.
The example below is based on the code in Adafruit_Motor_Shield_library\examples\MotorTest.ino, but with two motors. When run it Motor 1 will go Forward and Back but Motor 2 does nothing. What I am missing ?
#include <AFMotor.h>
AF_DCMotor motor1(1, MOTOR12_64KHZ); // create motor #1, 64KHz pwm
AF_DCMotor motor2(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
}
void loop() {
Serial.println("Start Motor 1");
motor1.run(FORWARD); // turn it on forward
delay(2000);
motor1.run(BACKWARD); // go the other way
delay(2000);
Serial.println("Start Motor 2");
motor2.run(FORWARD); // turn it on forward
delay(2000);
motor2.run(BACKWARD); // go the other way
delay(2000);
}
So does anyone know where I can find a detailed description of the AFMotor library ? Turns out that if I leave MOTOR12_64KHZ out of the AF_DCMotor instance definition that things work fine. A description of the parameters would be very helpful, but the library itself has nothing, not does GitHub. Tx
Yes, multiple times, and I can not find any place where it explains the details of the parameters for the library calls. I also just found out that unless you define motor.setSpeed for each motor it will only drive one motor. And it is possible that has been the issue all along, as the single motor examples don't define it. Good thing this is such a good forum in terms of people helping. Thanks