Real time data acquisition with Bluetooth

4 次查看(过去 30 天)
I'm trying to acquire ECG signals real time using Bluetooth HC-05. In Arduino IDE I get 150 samples/second, but here I get 50-60 samples/seconds. The function drawnow its delaying my aquisition a lot and I lose a part of the signal. I tried drawnow limitrate but sometimes its giving me some random samples. Can I make it faster, I want to get 150 samples/second. And another question is how does that fscanf work? If "b" is an object can't i access every value received from the object like b.Value or something like that?
b = instrfind('Type', 'bluetooth', 'Name', 'Bluetooth-HC-05:1', 'Tag', '');
if isempty(b)
b = Bluetooth('HC-05', 1);
else
fclose(b);
b = b(1);
end
fopen(b);
figure
h = animatedline;
ax = gca;
ax.YGrid = 'on';
i=1;
x = zeros();
stop = false;
startTime = datetime('now');
while ~stop
% Read current voltage value
x(1,i) = str2double(fscanf(b));
% Get current time
t = time2num((datetime('now') - startTime),'seconds');
% Add points to animation
addpoints(h,t,x(1,i))
drawnow
i = i+1;
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by