Expand description
I2C driver for the SPL06-007 pressure and temperature sensor. This sensor is available as a breakout board for the Arduino platform. This driver may also work with the SPL06-001, but this has not been tested.
This sensor operates on the I2c address 0x76 and is connected to the I2C bus on the Arduino Uno. Instantiate the Barometer struct with a reference to the I2C bus. The sensor will then be ready to read temperature and pressure values.
ⓘ
use spl06_007::*;
let mut barometer = Barometer::new(&mut i2c).expect("Failed to instantiate barometer");
let temp = barometer.get_temperature().unwrap();
let pressure = barometer.get_pressure().unwrap();
let altitude = barometer.altitude(1020.0).unwrap();You can set the mode, sample rate, and oversampling values manually:
ⓘ
barometer.set_pressure_config(SampleRate::Single, SampleRate::Eight);
barometer.set_temperature_config(SampleRate::Single, SampleRate::Eight);This is useful for more rapid updates, better precsion, or lower power draw.
It is also possible to set the mode to Mode::Standby to reduce power consumption.:
ⓘ
barometer.set_mode(Mode::Standby);Structs
- The SPL06-007 barometer.
Enums
- Use Barometer::set_mode to set the mode.
- Setting for the sampling and oversampling rates.