Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

Driving DC motors with Adafruit motor shield V1.1
Moderators: adafruit_support_bill, adafruit

Driving DC motors with Adafruit motor shield V1.1

by gwd on Mon Jan 28, 2013 9:58 pm

How do I find or write code to run 4 small DC motors at one time?
gwd
 
Posts: 5
Joined: Mon Jan 21, 2013 5:21 pm

Re: Driving DC motors with Adafruit motor shield V1.1

by adafruit_support_bill on Mon Jan 28, 2013 10:15 pm

We have not manufactured or sold the V1.1 shield for several years now. Where did you purchase your shield?

adafruit_support_bill
 
Posts: 37483
Joined: Sat Feb 07, 2009 10:11 am

Re: Driving DC motors with Adafruit motor shield V1.1

by gwd on Tue Jan 29, 2013 9:48 am

I purgchased the Motor Shield Kit v1.1 from Makershed.com in Dec 2012
gwd
 
Posts: 5
Joined: Mon Jan 21, 2013 5:21 pm

Re: Driving DC motors with Adafruit motor shield V1.1

by adafruit_support_bill on Tue Jan 29, 2013 9:57 am

Hmmm. MakerShed should have the V1.2 boards. Can you post a photo of the board?

adafruit_support_bill
 
Posts: 37483
Joined: Sat Feb 07, 2009 10:11 am

Re: Driving DC motors with Adafruit motor shield V1.1

by Arctic_Eddie on Tue Jan 29, 2013 10:10 am

I have a motor shield kit in my hand that I bought last year. The package says V1.1 with a web link:

http://adafruit.com/products/81

This shows a photo of your latest kit but it shows V1.0. My board is not the same as your photo and says V1.2.

What is the latest version?
Arctic_Eddie
 
Posts: 208
Joined: Tue Feb 28, 2012 6:01 pm
Location: St. Petersburg, FL

Re: Driving DC motors with Adafruit motor shield V1.1

by adafruit_support_bill on Tue Jan 29, 2013 10:48 am

1.2 is the latest version. It should be a blue board. Sounds like maybe the package labeling is a source of confusion. The product description should be updated too.

Thanks Arctic_Eddie!

adafruit_support_bill
 
Posts: 37483
Joined: Sat Feb 07, 2009 10:11 am

Re: Driving DC motors with Adafruit motor shield V1.1

by adafruit_support_bill on Tue Jan 29, 2013 10:54 am

Back to the original question:
How do I find or write code to run 4 small DC motors at one time?


You need to declare 4 different motors, one for each of the motor channels. Then you can command each motor by name.
Code: Select all | TOGGLE FULL SIZE
#include <AFMotor.h>

AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");

  // turn on motor
  motor1.setSpeed(200);
  motor2.setSpeed(200);
  motor3.setSpeed(200);
  motor4.setSpeed(200);
 
  motor1.run(RELEASE);
  motor2.run(RELEASE);
  motor3.run(RELEASE);
  motor4.run(RELEASE);
}

void loop()
{
  uint8_t i;
 
  Serial.print("tick");
 
  motor1.run(FORWARD);
  motor2.run(BACKWARD);
  motor3.run(FORWARD);
  motor4.run(BACKWARD);
  for (i=0; i<255; i++)
  {
    motor1.setSpeed(i); 
    motor2.setSpeed(i); 
    motor3.setSpeed(i); 
    motor4.setSpeed(i); 
    delay(10);
  }
}

adafruit_support_bill
 
Posts: 37483
Joined: Sat Feb 07, 2009 10:11 am

Re: Driving DC motors with Adafruit motor shield V1.1

by gwd on Tue Jan 29, 2013 9:05 pm

My board is blue but the package says v1.1. I tried to post a picture but It did not post. I will try again. I uploaded the code that you suggested and got motors 1 and 2 to run but not motors 3 and 4. Your help is much appreciated in getting me headed in the right direction.
gwd
 
Posts: 5
Joined: Mon Jan 21, 2013 5:21 pm

Re: Driving DC motors with Adafruit motor shield V1.1

by gwd on Tue Jan 29, 2013 9:07 pm

Hopefully, these pictures will post this time
P1010564.JPG
P1010564.JPG (156.5 KiB) Viewed 949 times
P1010565.JPG
P1010565.JPG (155.5 KiB) Viewed 949 times
gwd
 
Posts: 5
Joined: Mon Jan 21, 2013 5:21 pm

Re: Driving DC motors with Adafruit motor shield V1.1

by adafruit_support_bill on Wed Jan 30, 2013 7:20 am

OK. That is a 1.2 board. The version number is printed just above the M1,M2 motor terminal block. You have the L293D for M3-M4 installed backwards. The notch needs to line up with the one on the silkscreen.

adafruit_support_bill
 
Posts: 37483
Joined: Sat Feb 07, 2009 10:11 am

Re: Driving DC motors with Adafruit motor shield V1.1

by gwd on Wed Jan 30, 2013 11:38 pm

I re-installed the L293D correctly but motors 3 & 4 still did not work . I then rotated the two to make sure it was not damaged, but I still get the same result. I really appreciate your time, suggestions and prompt replies.
gwd
 
Posts: 5
Joined: Mon Jan 21, 2013 5:21 pm

Re: Driving DC motors with Adafruit motor shield V1.1

by adafruit_support_bill on Thu Jan 31, 2013 7:21 am

It is hard to see in the photos, but you have a few solder joints that appear a little 'solder-starved' - including a couple of pins on that L293D. Take a close look and touch up any joints that look suspicious.

http://learn.adafruit.com/adafruit-guid ... n-problems

adafruit_support_bill
 
Posts: 37483
Joined: Sat Feb 07, 2009 10:11 am