Skip to content

Utilería de software, escrita en Rust, para la gestión de cultivos acuáticos de pequeña escala.

Notifications You must be signed in to change notification settings

saibatizoku/benita

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

benita

Build Status

Talk directly to your sensor, via i2cdev.

Run benita on your Raspberry Pi (currently tested on RPi 3), hookup your sensors to the I2C bus, and start coding!

Quickstart

Initialize pre-configured sensors, just say which i2cdev path, and which I2C Address to call on.

At the moment, conductivity, temperature, and ph sensors are available.

The simplest way to start talking to a sensor is to use the new(path, address) associated function on the device.

A Simple pH sensor

extern crate benita;

use benita::config::SensorConfig;
use benita::errors::*;
use benita::ph::device::PhSensor;

fn main() {
    // Create a sensor directly with the i2cdev path, and the integer value
    // of the I2C address for our sensor.
    let ph_sensor = PhSensor::new("/dev/i2cdev-0", 100)?;

    // use the sensor to issue a command request and display the response.
    let response = ph_sensor.get_device_info()?;
    println!("Sensor Info: {}", response);

    // custom code goes here...
}

pH Sensor with typed configuration

extern crate benita;

use benita::config::SensorConfig;
use benita::errors::*;
use benita::ph::device::PhSensor;


fn main() {

    // Same goes for...
    // First, create a sensor configuration with the i2cdev path, and the
    // integer value of the I2C address for our sensor.
    let ph_config = SensorConfig::new("/dev/i2cdev-0", 99);

    // Second, we can start working with our sensor device.
    let ph_sensor = PhSensor::from_config(ph_config)?;

    // use the sensor to issue a command request and display the response.
    let response = ph_sensor.get_reading()?;
    println!("Current pH: {}", response);

    // custom code goes here...
}

About

Utilería de software, escrita en Rust, para la gestión de cultivos acuáticos de pequeña escala.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%