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

2 次查看(过去 30 天)
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 :)

回答(0 个)

社区

更多回答在  Power Electronics Control

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by