1

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);
}

GoatZ
  • 31
  • 2

1 Answers1

3

You need a power supply like shown here enter image description here

The shield is composed of an H-bridge which needs to be powered by an external source such as 9v batteries.

  • Thanks so much! Just a question, if I powered the Arduino with a 9V battery, would I still need to power the Motor Shield with another battery? – GoatZ Nov 21 '19 at 02:19