archlinux - Arduino + 3 step motors with a bipolar steppermotor controllor

2 views (last 30 days)
Hallo First of all I am useing archlinux and the mablab support package from http://www.mathworks.se/matlabcentral/fileexchange/32374 So for our university project we have to make a robotic arm which has to move en the 2D plane and rotate about it's own axis - We are confined to by the university to do this with an arduino and step motors and they prefer we program it all in MATLAB - I am using a bipolar steppermotor controllor to control the stepmotors, individually it is working fine, but I can't get them to run simultaneously and at this time I haven't been able to figure out the code to use - the code i am useing now is:
step=1800; %1800 steps
for i=1:step
a.digitalWrite(13,1);
pause(0.001)%Pause is neassesary not to stall step motor
a.digitalWrite(13,0);
pause(0.001)
end
What I was thinking might work is
tic
while toc/30<1
step=1800; %1800 steps
for i=1:step
a.digitalWrite(13,1);
pause(0.001)%Pause is neassesary not to stall step motor
a.digitalWrite(13,0);
pause(0.001)
end
end
while toc/60<1
step=1800;
for i=1:step
a.digitalWrite(8,1);
pause(0.001)
a.digitalWrite(8,0);
pause(0.001)
end
end
But this is not working like I had hoped. Hope anyone has an idea that can help me :)

Answers (0)

Communities

More Answers in the  Power Electronics Control

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!