Crates.io | dht20 |
lib.rs | dht20 |
version | 0.1.0 |
source | src |
created_at | 2023-09-21 19:27:38.78822 |
updated_at | 2023-09-21 19:27:38.78822 |
description | platform agnostic driver for dht20 temperature and humidity sensor |
homepage | https://github.com/MnlPhlp/dht20 |
repository | https://github.com/MnlPhlp/dht20 |
max_upload_size | |
id | 979865 |
size | 16,825 |
Rust driver for dht20 temp/hum sensor. Works on all platforms that implement embedded_hal.
let mut sensor = Dht20::new(
i2c/*platform specific i2c driver*/,
0x38,
esp_idf_hal::delay::Delay/*platform specific delay*/,
);
match sensor.read() {
Ok(reading) => println!("Temp: {} °C, Hum: {} %",reading.temp, reading.hum),
Err(e) => {
error!("Error reading sensor: {e:?}");
}
}