Crates.io | rppal-dht11 |
lib.rs | rppal-dht11 |
version | 0.4.0 |
source | src |
created_at | 2022-04-20 17:52:34.456735 |
updated_at | 2022-04-20 18:00:39.804352 |
description | Raspberry Pi Rust driver for the DHT11 temperature and humidity sensor. |
homepage | https://github.com/Xavientois/rppal-dht11-rs |
repository | https://github.com/Xavientois/rppal-dht11-rs |
max_upload_size | |
id | 571077 |
size | 10,485 |
Raspberry Pi Rust driver for the DHT11 temperature and humidity sensor, compatible with the rppal GPIO library IoPin
type.
Based on this driver, but modified to work on my Raspberry Pi 4B.
Include library as a dependency in your Cargo.toml
[dependencies]
rppal-dht11 = "0.3.1"
use rppal_dht11::Dht11;
use rppal::{gpio::Gpio, hal::Delay};
let pin = Gpio::new()?.get(DHT11_PIN)?.into_output_low();
// Create an instance of the DHT11 device
let mut dht11 = Dht11::new(pin);
let mut delay = Delay::new();
// Perform a sensor reading
let measurement = dht11.perform_measurement(&mut delay).unwrap();
println!("{:?}", measurement);
Copyright © 2020 Pietro Lorefice
Copyright © 2022 Xavientois
Dual licensed under your choice of either of: