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

6 次查看(过去 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