Hi, I am new to this, maybe I'm making an obvious mistake. I am trying to build a 2-wheel drive car with two motors controlled independently. This should be quite simple using this code:
#include <AFMotor.h>
AF_DCMotor motor1(1,MOTOR12_64KHZ);
AF_DCMotor motor2(2,MOTOR12_8KHZ);
void setup() {
motor1.setSpeed(105); //set the speed of the motors, between 0-255
motor2.setSpeed(105);
}
void loop() {
motor1.run(FORWARD);
motor2.run(FORWARD);
}
What is weird is that the code above does not work, only one motor runs. The only way I was able to have both motors run was when I moved one of them physically to the other side of the shield (M3 or M4), and changed the third line of my code to AF_DCMotor motor2(3,MOTOR12_8KHZ);
Does this make any sense? Is my shield bad? or am I misunderstanding how to use this part "MOTOR12_8KHZ"??
Thanks!