How to pass data from DHT11sensor (temperature&humidity Sensor) using Arduino software to Constant Block in Simulink?

조회 수: 4 (최근 30일)
hellos everyone . I am now working on a project that is the regulation of the temperautre and humidity with the help of the Arduino + DHT11 sensor and Simulink , I connected a script matlab in series with the Arduino software to extract values humidity and temperature to plots them in a graph. I'd like to display these values in Simulik for the regulation of these values ,I got Many problem at the declaration of set- param function here is the matlab code (exemple Temperature ):
s = serial ( 'COM5');
temps=1000;
i=1;
fopen(s);
while(i<temps)
fprintf(s, 'information de communication série');
out = fscanf(s)
global Temp ;
Temp(i) = str2num(out(1:4));
set_param('DHT11SIM','Temperature','value',num2str(Temp))
set_param('DHT11SIM', 'Temperature', 'update')
subplot(211);
plot(Temp,'g');
axis([0,temps,20,50]);
title('DHT11 Température');
xlabel('---> temps (secondes)');
ylabel('---> Température');
grid
code simulink:
here is the erruer thatI I always receives: Error using DHT (line 15) Invalid Simulink object name: DHT11SIM/Temperature .
please Help me

답변 (1개)

Damodar Reddy Ch
Damodar Reddy Ch 2019년 4월 8일
Please provide termination for while loop

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by