AFMOTOR library not compatible with Motor Shield v2.3

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
schnerkin
 
Posts: 3
Joined: Mon May 27, 2013 8:49 pm

AFMOTOR library not compatible with Motor Shield v2.3

Post by schnerkin »

I recently purchased the Motor/Stepper/Servo Shield (https://www.adafruit.com/products/1438) knowing full well that it was not compatible with the code library for v1. However, v1 was no longer available, and the "Install Software" page associated with the newer hardware said that adapting the library "isn't difficult". I also purchased Michael Margolis' book Make an Arduino-Controlled Robot, which is written on the assumption that I am using v1 of the motor shield.
My problem is that in my BattleBots-induced frenzy to make my own bot, I overlooked the fact that I don't have even the skills to conduct an internet search that could point me to the info I need to adapt the library. I've searched this site and the arduino forums using terms like "AFMOTOR library" and "Adafruit motor shield compatibility", but keep getting directed to threads about writing my own library, which is way more sophisticated than my current capabilities. I went this route because I want to learn, so I'm not afraid of doing the work, but it looks like I don't even know where to start. Can someone please point me in the right direction?

Here is the hardware I have, in case it makes a difference:
4WD robot chassis (purchased on Makershed.com, sorry!)
Arduino Uno
the shield mentioned above

The software for v1 is a library called "AFMOTOR", which I have installed.
The software for v2.3 is in a library called "ADAFRUIT_MOTORSHIELD", and I have that library installed as well.
I'm running Arduino 1.6.4 on Mac Os X Yosemite 10.10.4.

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: AFMOTOR library not compatible with Motor Shield v2.3

Post by adafruit_support_bill »

I overlooked the fact that I don't have even the skills to conduct an internet search that could point me to the info I need to adapt the library.
You don't need to adapt the library. You need to adapt the code. If you compare the examples from the V1 library with the same examples from the V2 library, it should be obvious what changes you need to make.

User avatar
schnerkin
 
Posts: 3
Joined: Mon May 27, 2013 8:49 pm

Re: AFMOTOR library not compatible with Motor Shield v2.3

Post by schnerkin »

So change the library reference to point to the new library instead of the old one like this?
(I haven't tried this yet, just making sure I understand your suggestion)
//#include <AFMotor.h> // adafruit motor shield library
#include <Adafruit_Motorshield.h> //V2 library

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: AFMOTOR library not compatible with Motor Shield v2.3

Post by adafruit_support_bill »

So change the library reference to point to the new library instead of the old one like this?
Yes. Then you need to change the motor control commands to match the syntax of the new library.

User avatar
schnerkin
 
Posts: 3
Joined: Mon May 27, 2013 8:49 pm

Re: AFMOTOR library not compatible with Motor Shield v2.3

Post by schnerkin »

I'll give it a shot. Thanks.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”