I am using the Seeed Studio Motor Shield V2 with the Uno. When I tried to upload the code to Arduino, I got the following error:
DCMotorDemo.cpp.o: In function loop': /Applications/DCMotorDemo.ino:18: undefined reference to motordriver'
/Applications/DCMotorDemo.ino:18: undefined reference to motordriver' /Applications/DCMotorDemo.ino:18: undefined reference to MotorDriver::goForward()'
/Applications/DCMotorDemo.ino:20: undefined reference to MotorDriver::stop()' /Applications/DCMotorDemo.ino:22: undefined reference to MotorDriver::goBackward()'
/Applications/DCMotorDemo.ino:24: undefined reference to MotorDriver::stop()' /Applications/DCMotorDemo.ino:26: undefined reference to MotorDriver::goLeft()'
/Applications/DCMotorDemo.ino:28: undefined reference to MotorDriver::stop()' /Applications/DCMotorDemo.ino:30: undefined reference to MotorDriver::goRight()'
/Applications/DCMotorDemo.ino:32: undefined reference to MotorDriver::stop()' DCMotorDemo.cpp.o: In function setup':
/Applications/DCMotorDemo.ino:11: undefined reference to motordriver' /Applications/DCMotorDemo.ino:11: undefined reference to motordriver'
/Applications/DCMotorDemo.ino:11: undefined reference to MotorDriver::init()' /Applications/DCMotorDemo.ino:12: undefined reference to MotorDriver::setSpeed(signed char, unsigned char)'
/Applications/DCMotorDemo.ino:13: undefined reference to `MotorDriver::setSpeed(signed char, unsigned char)'
Do you know how to solve this issue? I am using a Mac. I store the file under Documents > From seeed studio > MotorDriver > examples > DCMotorDemo > DcMotorDemo.ino
PaulS:
"The" code has problems. If you need help fixing them, where the hell is "the" code?
Here is the code in DCMotorDemo.ino :
// Demo function:The application method to drive the DC motor.
// Author:Frankie.Chu
// Date:20 November, 2012
#include "MotorDriver.h"
void setup()
{
/Configure the motor A to control the wheel at the left side./
/Configure the motor B to control the wheel at the right side./
motordriver.init();
motordriver.setSpeed(200,MOTORB);
motordriver.setSpeed(200,MOTORA);
}
Have you followed the instructions in the link that Bijendra posted above? From what you described you've definitely not put the library folder in the correct place.
I have just followed the instructions in the link that Bijendra posted. Under Sketch->Import Library, I see MotorDriver under Contributed. Thank you very much.
What shall I do in order to run the demo, try to learn from it by making some changes and see how the motors turn? As the link which Bijendra provided mentioned, I did not unzipped the downloaded library. Could you please let me know the proper way?
PaulS:
I followed the same instructions, and got the same errors. I can't determine what the problem is. The code certainly looks like it should compile.
So is it looking like an error in the library files?
OK Just downloaded MotorDriver20121210.zip.
Extracted into my sketch/libraries directory.
Opened the IDE (v1.0.6)
Clicked File.. Examples.. MotorDriver.. DCMotorDemo
Compiled fine.
Closed everything then opened IDE (V1.0.5 rev2)
Went through the same process
It compiles again.