MATLAB Answers


Adafruit Motor Shield MATLAB GUI

Asked by Colm
on 7 Aug 2014
Hi all,
This is my first post.
I am currently building an xy gantry as a part of a project. I am using an Arduino Uno, an Adafruit Motor Shield, and 2 stepper motors. I have interfaced the Arduino with a MATLAB GUI and the connection is working great but what I am finding is that as I run the program I created I cannot run the 2 motors simultaneously. One axis moves the required steps and then once its finished the second moves. Its simple code but surely it should work?
function BeginButton_Callback(hObject, eventdata, handles)
% hObject handle to BeginButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global a;
a.stepperSpeed(1, 1);
a.stepperSpeed(2, 1);
a.stepperStep(1, 'backward', 'double',255);
a.stepperStep(2, 'forward', 'double', 255);
I've seen a cnc build on the arduino website where they speak of using a motor shield and sparkfun easy driver to drive the 3 motors but cannot get it to work myself.
Can anyone help me out on this one?


Sign in to comment.

0 Answers