DHT20 Temperature and Humidity

版本 0.7 (6.4 KB) 作者: Eric Prandovsky
MATLAB + Arduino I2C DHT20 Temperature and Humidity sensor support
39.0 次下载
更新时间 2022/12/6

查看许可证

Support for the latest DHT sensor: the DHT20
The DHT20 sensor is an I2C sensor and must be connected to the I2C port of the Arduino
1. First, define your Arduino in your workspace:
a = arduino('C','Nano3','Libraries',{'I2C'});
2. Then, tell MATLAB that there is a DHT20 sensor attached to it.
dht20obj = dht20(a);
3. Once you've created your sensor object, you can ask it to take temperature and humidity readings, or both:
myTemperature = readTemperature(dht20obj);
myHumidity = readHumidity(dht20obj);
myDHTSensorData = readRawSensorData(dht20obj);
% can also call it using . annotation:
dht20obj.readHumidity;
dht20obj.readTemperature;
dht20obj.readSensorData;

引用格式

Eric Prandovsky (2024). DHT20 Temperature and Humidity (https://www.mathworks.com/matlabcentral/fileexchange/121792-dht20-temperature-and-humidity), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2022b
与 R2021a 及更高版本兼容
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
0.7