シリアル通信でArduinoから複数のデータをMATLABに送るやり方を教えてください
17 views (last 30 days)
Show older comments
ArduinoからMATLABにシリアル通信で1つのデータを送信しそれを受けてプロットするプログラムは作成できたのですが複数のデータを扱う方法が分からないので教えてください。
以下に1つのデータ扱うプログラムを記載します。
clear all
clc
s = serial('COM7', 'BaudRate', 9600, 'Terminator', 'CR', 'StopBit', 1, 'Parity', 'None');
fopen(s);
t=1;
out = 0;
while(1)
if (t<=30)
fprintf(s,'1');
out(t) = str2double(fscanf(s))
else
fclose(s);
delete(s);
clear s
break;
end
t = t+1;
end
t=1:1:30;
figure
plot(t,out,'-.')
hold on
0 Comments
Answers (0)
See Also
Categories
Find more on Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!