I've been trying to run a DC motor using the example code of the Adafruit Motor Shield v2.3 library (with Arduino UNO R3).
The motor is a 4.5W , 12v DC motor.
I'm using an external power supply of 12v / 3A (the power jumper is in place on the shield) .
I've connected the motor to the M1 input as in the tutorial and all I can here is a week high pitch sound, and the motor is not running.
I've tried changing the input to M2 and changing the speed to all kind of values between 10 and 200 and it didn't make a difference.
Also tried to change the motor to another one with similar features, but the problem persists.
I should also mention that I am able to (separately) operate a stepper motor using this shield on the same UNO.
I don't know what is wrong ....
The code:
Code: Select all
#include <Wire.h>
#include <Adafruit_MotorShield.h>
// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Select which 'port' M1, M2, M3 or M4. In this case, M1
Adafruit_DCMotor *myMotor = AFMS.getMotor(2);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Adafruit Motorshield v2 - DC Motor test!");
AFMS.begin(1000); // create with the default frequency 1.6KHz
myMotor->setSpeed(250);
}
void loop() {
myMotor->run(FORWARD);
delay(1000);
}