2个不稳定版本
0.4.0 | 2022年4月20日 |
---|---|
0.3.1 | 2022年4月20日 |
#27 in #humidity-sensor
7KB
111 行
rppal-dht11-rs
Raspberry Pi Rust驱动程序,用于DHT11温度和湿度传感器,兼容于rppal GPIO库的IoPin
类型。
基于此驱动程序,但修改后可在我的Raspberry Pi 4B上运行。
要求
- Rust 1.43+
用法
在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);
许可证
版权所有 © 2020 Pietro Lorefice
版权所有 © 2022 Xavientois
双许可,您可以选择以下之一
- Apache许可证版本2.0,(LICENSE-APACHE或https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT许可证 (LICENSE-MIT或http://opensource.org/licenses/MIT)
依赖项
~0.4–7.5MB
~46K SLoC