arduino simulink control dc motors
1 次查看(过去 30 天)
显示 更早的评论
Hi
I want to control 3 dc motors with encoders so I have used simulink and arduino (3arduino boards)
I used matlab function block in simulink area for controlling method and for writting the voltage of the dc motors and for the reading the position and velocity of encoders
in fact I have used 3 matlab function but when I run the simulink it showed error the code that I have wriiten in matlab function to read the position and velocity is:
function [count1 count2 count3 speed1 speed2 speed3]=fcn
a1=arduino('com3','due','Libraries','RotaryEncoder');
a2=arduino('com5','uno','Libraries','RotaryEncoder');
a3=arduino('com6','uno','Libraries','RotaryEncoder');
encoder1=rotaryEncoder(a1,'D2','D3',4000);
encoder2=rotaryEncoder(a2,'D2','D3',4000);
encoder3=rotaryEncoder(a3,'D2','D3',48);
count1=readCount(encoder1);
speed1=readSpeed(enocder1);
count2=readCount(encoder2);
speed2=readSpeed(encoder2);
count3=readCount(encoder3);
speed3=readSpeed(encoder3);
end
and the errors are:
0 个评论
回答(0 个)
社区
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Arduino Hardware 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!