arduino simulink control dc motors

조회 수: 1 (최근 30일)
john white
john white 2019년 3월 15일
편집: john white 2019년 3월 16일
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개)

커뮤니티

더 많은 답변 보기:  Power Electronics Community

카테고리

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