#temperature-humidity #humidity-sensor #raspberry-pi #pi #raspberry

no-std rppal-dht11

Raspberry Pi Rust驱动程序,用于DHT11温度和湿度传感器

2个不稳定版本

0.4.0 2022年4月20日
0.3.1 2022年4月20日

#27 in #humidity-sensor

MIT/Apache

7KB
111

rppal-dht11-rs

crates.io badge docs.rs badge

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

双许可,您可以选择以下之一

依赖项

~0.4–7.5MB
~46K SLoC