arduino simulink control dc motors

1 view (last 30 days)
john white
john white on 15 Mar 2019
Edited: john white on 16 Mar 2019
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:

Answers (0)

Communities

More Answers in the  Power Electronics Control

Categories

Find more on Arduino Hardware in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!