Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 761 Bytes

README.md

File metadata and controls

25 lines (19 loc) · 761 Bytes

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()?;
}