hey guys can you help me with this.

조회 수: 1 (최근 30일)
husam alrajab
husam alrajab 2019년 5월 14일
댓글: husam alrajab 2019년 5월 17일
i'm going to print four variable on serial in fact when i run it ;it going to write this four variable in one value . my question is who to print more than one variable on serial and send it to arduino to use it in the same time.this is my matlab gui codes.
global a;
a=serial('COM4');
setpoint=str2num(get(handles.s,'string'));
aggkp=str2num(get(handles.k1,'string'));
aggki=str2num(get(handles.k2,'string'));
aggkd=str2num(get(handles.k3,'string'));
fprintf(a,'%d',setpoint);
fprintf(a,'%d',aggkp);
fprintf(a,'%d',aggki);
fprintf(a,'%d',aggkd);

채택된 답변

Mark Sherstan
Mark Sherstan 2019년 5월 17일
If you need to run all of that at the same time you need to run miltiple threads. Check out the Parallel computing toolbox for more information: https://www.mathworks.com/products/parallel-computing.html
I see you are running a PID controller so I would first check how long each of these tasks are actually taking using the profiler. If printing, writing, and updating the GUI is faster than you can acquire data and/or actuate your controller, then there is no need to run everything at the same time.
  댓글 수: 3
Mark Sherstan
Mark Sherstan 2019년 5월 17일
Look at the Simulink support package for Arduino. You can achieve fantastic control with all the built in Simulink controllers. This link should get you started, you can even run in real time.
husam alrajab
husam alrajab 2019년 5월 17일
i will .thanks for your help

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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