this is correct ADC recoard code with Real time ?

2 ビュー (過去 30 日間)
Minjae Yoo
Minjae Yoo 2018 年 5 月 5 日
編集済み: Minjae Yoo 2018 年 5 月 8 日
Hello.
Thanks you for click.
now, i want RC servo result via ADC with real time.
i am not sure, this code record plot of ADC with real time. is it fine for real time. can i get advise ?
clc; clear all; close all; %Reset all
a=arduino('COM4','Due','Libraries','Servo');
ai_pin='A6';
s = servo(a, 'D7');
tic;
i=0;
while (toc<4)
i=i+1;
t(i)=toc;
out(i)=readVoltage(a,ai_pin); %Already voltages calculated
figure(1)
plot(t,out,'r');
pause(0.05);
if toc < 2
in(i) = 0;
writePosition(s, in(i));
else
in(i) = 0.5;
writePosition(s, in(i));
end
end

回答 (1 件)

Han Du
Han Du 2018 年 5 月 8 日
MATLAB is not designed for real-time capturing of data. The toolbox is built on top of MATLAB and operates in a non real-time Microsoft Windows environment. Because of this, it is not possible to achieve deterministic real-time operation. What do you mean by saying real time?
  2 件のコメント
Minjae Yoo
Minjae Yoo 2018 年 5 月 8 日
Thanks you reply. in my case, realtime meaning "save data with real seconds". my misstake, sorry. yes.. to peoples, real time meaning real time is like kinda Vxworks.
Minjae Yoo
Minjae Yoo 2018 年 5 月 8 日
編集済み: Minjae Yoo 2018 年 5 月 8 日
i hoped save measured data from arduino board with real time(seconds).

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Support Package for Arduino Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by