#soil #adafruit #moisture #stemma

stemma_soil_moisture_sensor

A pure generic I2C crate for the Adafruit STEMMA soil moisture sensor

4 releases

new 0.2.1 Dec 1, 2024
0.2.0 Jun 25, 2024
0.1.1 Sep 28, 2023
0.1.0 Mar 13, 2023

#384 in Embedded development

Download history 7/week @ 2024-09-14 9/week @ 2024-09-21 39/week @ 2024-09-28 2/week @ 2024-10-05 1/week @ 2024-10-12 129/week @ 2024-11-30

130 downloads per month

MIT license

7KB
128 lines

Adafruit STEMMA soil moisture sensor   Latest Version

A pure generic I2C crate for the Adafruit STEMMA soil moisture sensor

Usage

use stemma_soil_moisture_sensor::prelude::*;

fn main() -> Result<(), SoilMoistureSensorError> {
    // Setup your I2C and import relevant delay

    let sensor = SoilSensor::new(i2c, delay).with_units(TemperatureUnit::Fahrenheit);
    // Full
    let reading = sensor.read()?;
    let temp = reading.temperature;
    let moist = reading.moisture;
    // Individual
    let temp = sensor.temperature()?;
    let moist = sensor.moisture()?;
}

Dependencies

~305–760KB
~17K SLoC