MotorShield and Arduino Due
Moderators: adafruit_support_bill, adafruit

MotorShield and Arduino Due

by titous on Thu Dec 27, 2012 5:08 pm

Hi there!

I know you haven't had time to properly test the due with the shield and thus make any changes to your library; so I was hoping to do it for you...

However I've hit a roadblock I can't figure out myself: when trying to upload a sketch that uses the AFMotor library, I get the error: "_B was not declared in this scope". It makes me think that the core Arduino functions are not being loaded properly and I'm guessing it has to do with the following lines of code found in AFMotor.cpp:
Code: Select all | TOGGLE FULL SIZE
#if (ARDUINO >= 100)
  #include "Arduino.h"
#else
  #if defined(__AVR__)
    #include <avr/io.h>
  #endif
  #include "WProgram.h"
#endif

Even if I get rid of the if statement
Code: Select all | TOGGLE FULL SIZE
  #include "Arduino.h"

I still get erros with _BV.

Any quick suggestions?
titous
 
Posts: 62
Joined: Thu Jun 21, 2012 9:19 am

Re: MotorShield and Arduino Due

by adafruit_support_bill on Thu Dec 27, 2012 5:19 pm

I did a bit of preliminary testing. There is quite a lot of work to be done in the library. All of the PWM timer code is processor specific and the Due is not one of the defined processors. As a result, a number of symbols are left undefined when compiling for the Due.
User avatar
adafruit_support_bill
 
Posts: 31041
Joined: Sat Feb 07, 2009 10:11 am

Re: MotorShield and Arduino Due

by titous on Thu Dec 27, 2012 5:21 pm

so just wait and drown my sorrows until a new library is written while i try to trudge through it? :(

i figured as such, thanks for the help, i'll keep checking for the new library if i can't figure it out in the mean time!
titous
 
Posts: 62
Joined: Thu Jun 21, 2012 9:19 am

Re: MotorShield and Arduino Due

by esnyder on Wed Mar 20, 2013 6:15 pm

Just in case anyone else is interested in getting this working on the Due too; my current work in progress is at https://github.com/esnyder/Adafruit-Mot ... ld-library

I have it compiling, and (kinda) running. But it doesn't actually use the frequency values you give the controller on construction. If I manage to get it in shape I'll see if the main project will merge it.

It looks to me like the Due board doesn't have "real" PWM capable pins from the SAM3 on digital pins 3, 5 or 11. My current plan is to try to use the same interrupt timer that the core arduino library uses for doing PWM on those pins so that it will honor the frequency values given.
esnyder
 
Posts: 4
Joined: Fri Feb 01, 2013 2:22 pm