I'm trying to test a basic robot, and have run into an issue. I have a motor shield connected to an Arduino and the whole thing is powered by 4 AA batteries. This issue is when I turn on the device with the following very simple sketch (used just for testing) I just get a buzzing sound.
There are two DC motors, one attached to M1 and the other attached to M2.
I tried the following to troubleshoot:
I connected the wires of the motors to the + and - screws on the motor shield, and each motor worked, so I know I am getting power to the board, and I know each of the motors work.
I've also double checked to make sure my polarity was correct.
I played around with the KHZ setting in the sketch, not sure if that has any impact, put I've used 80 and 64)
I've attached a pic of my setup (in the pic the motor wires are disconnected as I was testing variables.
Any help would be appreciated.
#include <AFMotor.h> //import your motor shield library
AF_DCMotor motor1(1,MOTOR12_64KHZ); // set up motors.
AF_DCMotor motor2(2, MOTOR12_64KHZ);
void setup() {
motor1.setSpeed(105);
motor2.setSpeed (105);
}
void loop() {
motor1.run(FORWARD);
motor2.run (FORWARD);
}