Embassy DHT Sensor Library
This Rust library provides an interface for interacting with DHT1X and DHT2X temperature and humidity sensors using the Embassy framework.
Only test on raspberry pico (w) (RP2040)
Pico 2 (RP2350) may be work
Getting Started
Installation
Add embassy-dht-sensor to your Cargo.toml:
[]
= "0.1.8"
Usage
Initialize your Raspberry Pi Pico board with Embassy. Create an instance of DHTSensor with the GPIO pin connected to your DHT sensor. Use the read method to get temperature and humidity readings.
Example
// for dht22
use Spawner;
use *;
use ;
use embassy_rp;
use DHT22;
async
// for dht11
use Spawner;
use *;
use ;
use embassy_rp;
use DHT11;
async
New feature embedded_alloc
to enable it by ,add to Cargo.toml
= { = "0.1.7", = ["embedded_alloc"] }
when enable embedded_alloc we will get new fn in DHT11/DHT22 mod
examples
https://github.com/sndnvaps/embassy-dht/tree/main/examples/picow-display-embedded-alloc
https://github.com/sndnvaps/embassy-dht/tree/main/examples/picow-display
Pick up idea from https://crates.io/crates/embassy-dht-sensor