Hello All,
Tried to make a build with this lib:
and the build doesn't compile.
Is there a lib that's officially supported by Arduino for this motor shield? I see Rev2 - but not Rev3.
Thanks In Advance!
John W.
Hello All,
Tried to make a build with this lib:
and the build doesn't compile.
Is there a lib that's officially supported by Arduino for this motor shield? I see Rev2 - but not Rev3.
Thanks In Advance!
John W.
--- or - I guess you don't really need to have a lib work with this.... ok.
I think that the interface is straightforward enough that abstraction via a library is not really necessary. I would probably just define some variables for the pin names and states to make the code more self documenting and call it good at that.
However, I'm certain that any of the 3rd party libraries for the L298 can be used with this shield. I saw several in the Library Manager. I'd be happy to see if I can spot the issue with the library you tried if you'll post the full error output.
Hello Pert,
Attached.
Also - I think the default config for the "Vin Connected" should be what it looks like - an open pad - I've attached a screen shot.
Why have something that will blow the Uno/Leonardo when using 12V motors as a default?
I used an X-Acto knife for awhile, checked with USB camera - looked open - but Ohmmeter said no - still connected - so "SNIP" goes the Vin pin on the MTR Shield.
This pad should be OPEN by default - NOT SHORTED.
Just my 2cents.
Thanks,
John W.
mtr-shield-err.txt (37.8 KB)
jwestmoreland:
Attached.
From the error messages you shared:
...
C:\tmp2\libraries\arduino-motor-shield-r3\ArduinoMotorShieldR3\examples\Demo/Demo.ino:9: undefined reference to `ArduinoMotorShieldR3::init()'
...
I wasn't able to reproduce these errors, but I can see from the paths that the library is not correctly installed.
Unfortunately, the author of the library used a non-standard structure in the repository. The best practices structure used by all official Arduino libraries and required for addition to the Library Manager index is for the library to be in the root of the repository, not in a subfolder. This requirement originates from the requirement that the installed library be in the root of the libraries folder.
In this case, the library is in the ArduinoMotorShieldR3 subfolder of the repository and this has resulted in your installation of the library being invalid. The fix is easy enough though: just move the C:\tmp2\libraries\arduino-motor-shield-r3\ArduinoMotorShieldR3 folder to C:\tmp2\libraries.
After that, I think the sketch should compile without any problems. I just tried it out with Arduino IDE 1.8.13 and the Arduino Leonardo and it compiled for me, so the library code does compile.
jwestmoreland:
Why have something that will blow the Uno/Leonardo when using 12V motors as a default?
I would guess the reasoning was to allow for a minimal set up when using very small motors.
I just looked at my shield and see that I had cut that jumper at some point so I guess it's pretty common to find it necessary to do this.
I also find cutting these things to be inconvenient. It's understandable requirement in cases where it would only be cut in rare circumstances, or when there is simply no room for anything else, but in this case it's a relatively common need and there is surely a good deal of spare space on the board. So I would prefer if a pin header jumper was used here.
@Per
Is there a GIT for the hardware to put a request in for a jumper header ?
The hardware design repositories are all private so only people with access to them can submit issues.
Pert,
Still getting this:
Arduino: 1.8.13 (Windows 10), TD: 1.53, Board: "Arduino Leonardo"
c:\AppData\Local\Temp\ccuVN8sT.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_Demo.ino.cpp.o.1963':
:(.text.startup+0x2c): undefined reference to `ArduinoMotorShieldR3::ArduinoMotorShieldR3()'
c:\AppData\Local\Temp\ccuVN8sT.ltrans0.ltrans.o: In function `setup':
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:9: undefined reference to `ArduinoMotorShieldR3::init()'
c:\AppData\Local\Temp\ccuVN8sT.ltrans0.ltrans.o: In function `loop':
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:15: undefined reference to `ArduinoMotorShieldR3::setM1Speed(int)'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:17: undefined reference to `ArduinoMotorShieldR3::setM2Speed(int)'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:19: undefined reference to `ArduinoMotorShieldR3::getM1CurrentMilliamps()'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:21: undefined reference to `ArduinoMotorShieldR3::getM2CurrentMilliamps()'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:25: undefined reference to `ArduinoMotorShieldR3::setM1Speed(int)'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:27: undefined reference to `ArduinoMotorShieldR3::setM2Speed(int)'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:29: undefined reference to `ArduinoMotorShieldR3::getM1CurrentMilliamps()'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:31: undefined reference to `ArduinoMotorShieldR3::getM2CurrentMilliamps()'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:35: undefined reference to `ArduinoMotorShieldR3::setM1Speed(int)'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:37: undefined reference to `ArduinoMotorShieldR3::setM2Speed(int)'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:39: undefined reference to `ArduinoMotorShieldR3::getM1CurrentMilliamps()'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:41: undefined reference to `ArduinoMotorShieldR3::getM2CurrentMilliamps()'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:45: undefined reference to `ArduinoMotorShieldR3::setM1Speed(int)'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:47: undefined reference to `ArduinoMotorShieldR3::setM2Speed(int)'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:49: undefined reference to `ArduinoMotorShieldR3::getM1CurrentMilliamps()'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:51: undefined reference to `ArduinoMotorShieldR3::getM2CurrentMilliamps()'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:55: undefined reference to `ArduinoMotorShieldR3::setM1Speed(int)'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:57: undefined reference to `ArduinoMotorShieldR3::setM2Speed(int)'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:59: undefined reference to `ArduinoMotorShieldR3::getM1CurrentMilliamps()'
C:\tmp2\libraries\ArduinoMotorShieldR3\examples\Demo/Demo.ino:61: undefined reference to `ArduinoMotorShieldR3::getM2CurrentMilliamps()'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Leonardo.
Regards,
John W.
Did you move ArduinoMotorShieldR3.h into the sketch folder?
This type of error occurs when the declarations are present, but not the definitions. That is usually caused by having the .h file, but not the .cpp file. In the verbose output like you posted the first time, we will usually see a helpful message about the library like:
Using library ArduinoMotorShieldR3 in folder:C:\tmp2\libraries\ArduinoMotorShieldR3 (legacy)
The fact that you didn't get a "No such file or directory" error for ArduinoMotorShieldR3.h and that a "Using library x in folder" message was not shown makes me think the library is not being used at all. With an unmodified version of the Demo.ino file, that would only be possible if the .h file had been moved into the sketch folder.
Hello Pert,
Oops - you are correct sir.
I guess when I moved some stuff around I dragged a few things where they didn't belong.
...
"C:\Users\john\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "c:\AppData\Local\Temp\arduino_build_471399/Demo.ino.elf" "c:\AppData\Local\Temp\arduino_build_471399/Demo.ino.hex"
Using library ArduinoMotorShieldR3 in folder: C:\tmp2\libraries\ArduinoMotorShieldR3 (legacy)
"C:\Users\john\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "c:\AppData\Local\Temp\arduino_build_471399/Demo.ino.elf"
Sketch uses 6302 bytes (21%) of program storage space. Maximum is 28672 bytes.
Global variables use 409 bytes (15%) of dynamic memory, leaving 2151 bytes for local variables. Maximum is 2560 bytes.
Now - off to see if the motors work...
THANKS!
John W.
You're welcome. I'm glad to hear it's working now. Enjoy!
Per
Thanks Again Per! ![]()
Maybe a note also - with these brushed DC motors - I still had to use a fast recovery diode so the power supply didn't trip - I thought this board could handle that - so please add that to the list for Rev4 - needs a spot for a fast recovery diode for applications that may need that.
Regards,
John
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.