Skip to content

Simple rust AHT10 driver implementing embedded-hal

License

Notifications You must be signed in to change notification settings

jnthbdn/rs-aht10

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AHT10 Rust Library

crates.io MIT GitHub

Why?

I haven't found a driver that works simply (without async 😉 ) for an embedded environment and #no_std.

Usage

First, create the AHT10 struct, with your I2C

let mut aht = AHT10::new(i2c1);

Then, initialize the sensor

match aht.initialize() {
    Ok(_) => (),
    Err(e) => {
        // AAAAaarrrgggg.... 😵
    }
}

Finally, read the data:

match aht.read_data(&mut delay) {
    Ok(data) => {
        // Yay ! It works !
        let celsius = data.temperature_celsius();
        let fahrenheit = data.temperature_fahrenheit(); // 😶
        let humidity = data.humidity();
    }
    Err(e) => {
        // AAAAaarrrgggg... 😵
    }
};

Example

There is only one example named rp_pico_aht10. It uses GPIOs 2 & 3 (SDA & SCL respectively) and print data on USB serial port.

About

Simple rust AHT10 driver implementing embedded-hal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages