How to pass data from DHT11sensor (temperature&humidity Sensor) using Arduino software to Constant Block in Simulink?
2 views (last 30 days)
Show older comments
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166162/image.png)
here is the erruer thatI I always receives: Error using DHT (line 15) Invalid Simulink object name: DHT11SIM/Temperature .
please Help me
0 Comments
Answers (1)
See Also
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!