Skip to main content

Crate lh_dht22_rp

Crate lh_dht22_rp 

Source
Expand description

DHT22 humidity and temperature sensor driver for the RP2040 microcontroller. Based on rp2040_hal and embedded_hal

Communicates though a single data wire which requires special pin handling for bi-directional communication.

Reference: https://cdn-shop.adafruit.com/datasheets/Digital+humidity+and+temperature+sensor+AM2302.pdf

Example:

 
use lh_dht22_rp as dht22;
...

// Hal Boilerplate ...
...

let dht_pin = pins.gpio1;
let mut dht = dht22::DHT22::new(dht_pin, timer);

match dht.read() {
    Ok((humidity, temperature)) => {
           println!("Humidity   : {:.1} %RH", humidity);
           println!("Temperature: {:.1} C", temperature); },
    Err(e) => println!("Err: {e}"),
    }

Structs§

DHT22

Enums§

DhtError

Traits§

ReconstructPin
Trait for constructing a dynamic input or output pin from scratch

Type Aliases§

Result