stemma_soil_sensor

Crates.iostemma_soil_sensor
lib.rsstemma_soil_sensor
version0.1.5
sourcesrc
created_at2020-07-19 23:44:36.203027
updated_at2020-07-21 00:23:58.74963
descriptionLibrary for reading data from Adafruit STEMMA Soil Sensor
homepage
repositoryhttps://github.com/cfsamson/embedded-stemma-soil-sensor
max_upload_size
id267051
size14,209
Carl Fredrik Samson (cfsamson)

documentation

https://docs.rs/stemma_soil_sensor

README

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!("Temperature: {:.02}", temp);
       println!("Capacitance: {}", cap);
       let mut delay = Delay {};
       delay.delay_ms(2000u32);
   }
}

Using this library with other boards

Since this library relies on rppal for the I2C communication it won't work with other boards than the Raspberry Pi series boards as it is right now.

Requirements

This library should build on the following targets:

  • armv7-unknown-linux-gnueabihf
  • armv7-unknown-linux-musleabihf
  • aarch64-unknown-linux-gnu

Additional notes

Please make a note of that the repository includes a .cargo/config entry. This is excluded from the crate package. If you use this library from the repository directly make sure to change this (or remove it) so it doesn't cause problems for your build.

Commit count: 10

cargo fmt