My final code, for readings once a minute:
s = serial('COM3'); %Connected to COM3
set(s,'BaudRate',9600);
set(s,'Timeout', 65); %sensor will timeout after 65 seconds
fopen(s);
x = 1:1:60; %readings over the span of one hour
for i=1:length(x)
y(i) = fscanf(s, '%f', 6);
z(i) = fscanf(s, '%f', 6);
i
end
fclose(s);
% Plot data from arduino
plot3(x,y,z)
title('temperature v. humidity v. time');
xlabel('time');
ylabel('humidity');
zlabel('temperature');
3 Comments
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/75259-accurate-measurements-with-dht11-and-arduino-via-matlab#comment_148924
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/75259-accurate-measurements-with-dht11-and-arduino-via-matlab#comment_148924
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/75259-accurate-measurements-with-dht11-and-arduino-via-matlab#comment_149328
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/75259-accurate-measurements-with-dht11-and-arduino-via-matlab#comment_149328
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/75259-accurate-measurements-with-dht11-and-arduino-via-matlab#comment_487185
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/75259-accurate-measurements-with-dht11-and-arduino-via-matlab#comment_487185
Sign in to comment.