Info

This question is closed. Reopen it to edit or answer.

How to decrease the delay between functions. Useing arduino to controll stepper motors.

1 view (last 30 days)
Hi,
We are working on project, were we need to controll two steppers motors, useing arduino with a adafruit v2 motorshield.
We have two problems:
1. Ii it possible to get the two motors running at the same time? Using only 1 arduino bord with both motors connectet to the motorshield.
2. When we run our functions, there is quit a big delay between them. Is it possible to reduce the delay?
We are using the matlab packede for arduino. We run each motor with a function like:
-----------------------------------------------------------------
function motor2(x)
a = arduino('com3', 'uno', 'Libraries', 'Adafruit\MotorShieldV2');
shield = addon(a, 'Adafruit\MotorShieldV2');
sm = stepper(shield, 1, 200); sm.RPM = 30; move(sm, x);
end
----------------------------------------------------------------------------------
To run the motors we just use a simpel script like:
---------------------------------------------------------------------------
for idx=0:2
motor1(100) motor2(100) motor2(-100) motor1(-100) end
clear idx
-----------------------------------------------------------------------
Hope that some are able to help :-)
Best Regards Christian

Answers (0)

Communities

More Answers in the  Power Electronics Control

Products

Community Treasure Hunt

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

Start Hunting!