I'm pretty new with Arduino and I'm trying to run a DC motor with an Adafruit Motor Shield V2.3. I followed the instructions on the Adafruit website but my motor doesn't start when I upload the code. I have connected it to the correct terminal (M3) and screwed it in place.
Here is a picture of the Arduino and Motor Shield: https://i.stack.imgur.com/d0tAF.jpg
And here is my code:
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_DCMotor *myMotor = AFMS.getMotor(3);
void setup()
{
AFMS.begin();
myMotor->setSpeed(255);
}
void loop()
{
myMotor->run(FORWARD);
delay(1000);
myMotor->run(BACKWARD);
delay(1000);
myMotor->run(FORWARD);
delay(1000);
myMotor->run(RELEASE);
delay(1000);
}