Crate stemma_soil_sensor

Source
Expand description

Library for retrieving readings from Adafruit STEMMA Soil Sensor.

The implementation is based on the Adafruit CircuitPython Seesaw library.

The library is tested and used on a Raspberry Pi 3 B+ board, running Raspbian but uses interfaces from embedded_hal operations like sleep/delay and other system calls.

§Example

pub fn main(interval_ms: u64) {
   use stemma_soil_sensor::SoilSensor;
   use linux_embedded_hal::Delay;
   use embedded_hal::blocking::delay::DelayMs;

   let delay = Delay {};
   let mut sensor = SoilSensor::init(delay).unwrap();

    loop {
       let temp = sensor.get_temp().unwrap();
       let cap = sensor.get_capacitance().unwrap();
       println!("The temperature is: {:.02}", temp);
       println!("The capacitance is: {}", cap);
       let mut delay = Delay {};
       delay.delay_ms(2000u32);
   }
}

§Debugging

There are a lot of debug! information in the code which will be available on debug builds. Attaching a logger and setting RUST_LOG=debug will yield a lot of information.

Structs§

SoilSensor

Enums§

SoilSensErr

Type Aliases§

Result