フィルターのクリア

Need help to see if the two codes I fused together are correctly placed

2 ビュー (過去 30 日間)
Batuhan Yildiz
Batuhan Yildiz 2022 年 11 月 12 日
clear all; close all;
a = arduino('/dev/tty.SLAB_USBtoUART', 'uno')
tic
max_samples = 1000;
tic
for i = 1:max_samples
sound_data(i) = readVoltage(a,'A2')
time_data(i) = toc;
end
plot(time_data, sound_data)
figure
h = animatedline;
ax = gca;
ax.YGrid = 'on';
ax.YLim = [-0.1 5];
title('Sound sensor voltage vs time (live)');
ylabel('Time [HH:MM:SS]');
xlabel('Voltage [volt]');
stop = false;
startTime = datetime('now');
while ~stop
voltage = readVoltage(a,'A2');
t = datetime('now') - startTime;
addpoints(h,datenum(t),voltage)
ax.XLim = datenum([t-seconds(15) t]);
datetick('x','keeplimits')
drawnow
stop = readDigitalPin(a,'D6');
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeJust for fun についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by