Failing to use the/control motors with Arduino Due. Full details inside.

Note: I am completely new with Arduino. Don't be too harsh if I am being stupid!

Let's start from the start. I am trying to control motors with an Arduino and a WiiMote. At first, I bought an Arduino Uno, the Adafruit v1 motor controller shield and the USB host shield (with bluetooth dongle). I downloaded the newest IDE and the Motor Shield Library, the Wii Library and the Host shield Library. So at first I tried moving a motor with the motor board and it worked (perfect!). Then I tried to connect with the WiiMote and failed (not so perfect). After a bit of research, I found that bluetooth dongles don't work with the Uno for reasons I don't understand. As a result, I bought a Due and tried to control a motor with it and failed. I got this error message:

   AF_DCMotor(uint8_t motornum, uint8_t freq = DC_MOTOR_PWM_RATE);
                                               ^
MotorTest:7: error: call to 'AF_DCMotor::AF_DCMotor(uint8_t, uint8_t)' uses the default argument for parameter 2, which is not yet defined
 AF_DCMotor motor(4);
                   ^
exit status 1
call to 'AF_DCMotor::AF_DCMotor(uint8_t, uint8_t)' uses the default argument for parameter 2, which is not yet defined

After frustration, I did a bit more research and found that it may be a problem with the IDE. So I downloaded the 1.0.6 version and tried it again but got this:

avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

After more research (yay!) I found that this is a common issue, however after trying many different get-arounds (I tried installing a boot loader with my Uno) but failed. Any help is appreciated!

Without further details I only can guess. The Due works on 3.3V, while the Uno works on 5V. This may be the reason why your modules only work with one of these boards. Your BT module also may draw too much current, so that you should use an external power supply for it.

Have you already tried to upload a simple demo sketch to your boards, with everything detached from the controller boards? The bootloader uses Serial, i.e. the RX/TX pins, so that you can not attach the BT module to these pins, while uploading a sketch or if you want to use the Serial Monitor in your code.

If these hints do not help, please post a circuit diagram of your project, including all power supplies.

I tried the blink thing and that worked fine, but then I tried the Motor test code which got the same error message:

Motor Test Code:

// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

#include <AFMotor.h>

AF_DCMotor motor(4);

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

  // turn on motor
  motor.setSpeed(200);
 
  motor.run(RELEASE);
}

void loop() {
  uint8_t i;
  
  Serial.print("tick");
  
  motor.run(FORWARD);
  for (i=0; i<255; i++) {
    motor.setSpeed(i);  
    delay(10);
 }
 
  for (i=255; i!=0; i--) {
    motor.setSpeed(i);  
    delay(10);
 }
  
  Serial.print("tock");

  motor.run(BACKWARD);
  for (i=0; i<255; i++) {
    motor.setSpeed(i);  
    delay(10);
 }
 
  for (i=255; i!=0; i--) {
    motor.setSpeed(i);  
    delay(10);
 }
  

  Serial.print("tech");
  motor.run(RELEASE);
  delay(1000);
}

Error Message:

In file included from /Users/*name*/Documents/Arduino/libraries/adafruit-Adafruit-Motor-Shield-library-99381df/examples/MotorTest/MotorTest.pde:5:0:
/Users/*name*/Documents/Arduino/libraries/adafruit-Adafruit-Motor-Shield-library-99381df/AFMotor.h:156:47: error: 'DC_MOTOR_PWM_RATE' was not declared in this scope
   AF_DCMotor(uint8_t motornum, uint8_t freq = DC_MOTOR_PWM_RATE);
                                               ^
MotorTest:7: error: call to 'AF_DCMotor::AF_DCMotor(uint8_t, uint8_t)' uses the default argument for parameter 2, which is not yet defined
 AF_DCMotor motor(4);
                   ^
exit status 1
call to 'AF_DCMotor::AF_DCMotor(uint8_t, uint8_t)' uses the default argument for parameter 2, which is not yet defined

That library is not written to work with a DUE. It will only work with AVR architecture processors (UNO, NANO, etc) or some PIC architectures (specifically whatever matches PIC32MX).

Pete

Oh. Darn it! Do you know a work around that doesn't cause me to fork out more cash on new stuff?

Sorry. Dunno.
The fact that it is designed to work with a 32-bit PIC suggests that it could be massaged to work with a DUE. But it's not something I want to tackle.

Pete

So it can be done but probably not. Well. Thanks a bunch for the help anyways! It really is appreciated!