Hello,
I have a 28byj-48 stepper motor and the shiel uln2003. I want to program the arduino to control the stepper using Matlab.
Code:
clear all; close all; clc;
a=arduino()
configurePin(a,'D2','DigitalOutput');
configurePin(a,'D3','DigitalOutput');
configurePin(a,'D4','DigitalOutput');
configurePin(a,'D5','DigitalOutput');
pins={'D2', 'D3', 'D4', 'D5'};
steps={'1100', '0110', '0011','1001'};
steps_size=size(steps,2); %steps = 4
for i = 1:100
step = steps{mod(i,steps_size)+1}; % step=1,2,3,4
for j=1:4
writeDigitalPin(a, pins{j}, str2double(step(j)));
end
%pause(0.01);
end
It works, but the speed at which the motor is turning around is very very slow. Does anyone knows how to increase the speed between Matlab and Arduino. I think that is something that has to do with the BaudRate.
Thank you,
GuilTy