I can't connect my Adafruit Motorshield v2.3 with matlab2014a.
Show older comments
Hello :)
I try to connect my Adafruit Motorshield v2.3 with Arduino Uno on matlab2014a (64bit as Win10):
Code:
a = arduino('COM6', 'Uno', 'Libraries', 'Adafruit/MotorShieldV2') Updating server code on Arduino Uno (COM6). Please wait.
Cannot program Arduino board Uno (COM6). Please make sure the board is supported and the port and board type are correct.
I installed the Arduino Addons and this works fine:
Code: a = arduino('COM6', 'Uno') Updating server code on Arduino Uno (COM6). Please wait.
a =
arduino with properties:
Port: 'COM6'
Board: 'Uno'
AvailableAnalogPins: [0, 1, 2, 3, 4, 5]
AvailableDigitalPins: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
Libraries: {'I2C', 'SPI', 'Servo'}
Is there a way to implement the Adafruit code? for me it seems this is missing.
Thanks for any help!
7 Comments
D
on 17 Feb 2016
Where you able to resolve this? I am having the exact same issue, except with Mega2560
Sebastian Roder
on 18 Feb 2016
Hello all,
i had the same problem but i fixed it with some help of the support.
First try to trace the error with: a = arduino('COM5', 'Uno', 'Libraries', 'Adafruit\MotorShieldV2','TraceOn',true,'ForceBuild',true)
The last lines of the error messag were:
In file included from C:\Users\lfn\AppData\Local\Temp\ArduinoServer/LibraryRegistration.h:1:0, from C:\MATLAB\SupportPackages\R2015b\arduino-1.6.1\libraries\MWArduino\MWArduino.cpp:518: C:\MATLAB\SupportPackages\R2015b\arduinoio\toolbox\matlab\hardware\supportpackages\arduinoio\+arduinoioaddons\+adafruit\src\MotorShieldV2Base.h:7:45: fatal error: utility/Adafruit_PWMServoDriver.h: No such file or directory #include "utility/Adafruit_PWMServoDriver.h"
So Matlab can't find the file "utility/Adafruit_PWMServoDriver.h". In the supportpackage folder in the subfolder utility (C:\MATLAB\SupportPackages\R2015b\arduino-1.6.1\libraries\Adafruit_MotorShield\utility) are files called "Adafruit_MS_PWMServoDriver.h", "Adafruit_MS_PWMServoDriver.cpp".
Open the following files with notpad++ or whatever: Adafruit_MotorShield.h, Adafruit_MotorShield.cpp (C:\MATLAB\SupportPackages\R2015b\arduino-1.6.1\libraries\Adafruit_MotorShield) and MotorShieldV2Base.h (C:\MATLAB\SupportPackages\R2015b\arduinoio\toolbox\matlab\hardware\supportpackages\arduinoio\+arduinoioaddons\+adafruit\src) and change "utility/Adafruit_PWMServoDriver.h" to "utility/Adafruit_MS_PWMServoDriver.h". Save! I hope it works for you two!
D
on 18 Feb 2016
This is beautiful, works fantastic, thank you!
bram verhelst
on 22 Feb 2016
Hey Sebastian,
thanks for the posted solution, however I do have some additional questions: I can only find "utility/Adafruit_PWMServoDriver.h" this in the Adafruit_MotorShield.h file. the other files you named are without the "utility". So do I change these file too or what should be changed in these other files?
Thanks for your help and sorry for my ignorance on this.
best wishes and thank Tom
bram verhelst
on 22 Feb 2016
YES!! I found how to do it. Thanks a lot sebastian! I found it thanks to your guide but mine was a little variant of yours.
So I didn't had the "utility/Adafruit_PWMServoDriver.h" in my files But I had "Adafruit_PWMServoDriver.h" in these two files C:\MATLAB\SupportPackages\R2015a\arduinoio\toolbox\matlab\hardware\supportpackages\arduinoio\+arduinoioaddons\+adafruit\src\MotorShieldV2Base.h and C:\MATLAB\SupportPackages\R2015a\arduinoio\toolbox\matlab\hardware\supportpackages\arduinoio\+arduinoioaddons\+adafruit\motorshieldv2.m
changing this "Adafruit_PWMServoDriver.h" into "Adafruit_MS_PWMServoDriver.h" in those two files and saving it did the trick!!! it is now working!
Thank you sooooo much! Hope this helps for others! Tom
QINGCHEN LIU
on 6 Mar 2016
Hey Sebastian,
thanks for the posted solution, when I type your trace on code and I get this error message below: The Arduino source 'Adafruit_MotorShield/Adafruit_MotorShield.h' for libraries 'Adafruit/MotorShieldV2' cannot be found. Install the 3P library source first and try again.
How can I deal with this? Thanks very much
Menghan
on 24 May 2016
Hi,
This issue has been fixed in MATLAB R2014a and onwards. If you have already installed the support package, please update it or reinstall the support package to get the latest update including the fix.
Please feel free to contact our Technical Support if you still see the error.
Thanks,
Menghan
(MathWorks - MATLAB Hardware Team)
Answers (0)
Categories
Find more on Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!