Function dht22_pi::read [] [src]

pub fn read(pin: u8) -> Result<Reading, ReadingError>

Read temperature and humidity from a DHT22 connected to a GPIO pin on a Raspberry Pi.

On a Raspberry Pi this is implemented using bit-banging which is very error-prone. It will fail 30% of the time. You should write code to handle this. In addition you should not attempt a reading more frequently than once every 2 seconds because the DHT22 hardware does not support that.