pub fn reporting(
address: u8,
celsius: f32,
relative_humidity: f32,
) -> CommandPartExpand description
An SHT3x that reads what it is asked to.
§Arguments
address- the address it answers to.celsius- the temperature it reports.relative_humidity- the humidity it reports, as a percentage.
§Returns
The part. Its readings land on the nearest steps its 16-bit words represent, within three thousandths of a degree and two thousandths of a percent.
§Examples
use pamoja_hal::script::DelayLog;
use pamoja_sensors::sht3x::{sim, Sht3x, I2C_ADDRESS_A};
let mut sensor = Sht3x::new(sim::reporting(I2C_ADDRESS_A, 30.0, 70.0), I2C_ADDRESS_A, DelayLog::new());
let reading = sensor.measure().expect("the part answers");
assert!((reading.temperature_celsius() - 30.0).abs() < 0.01);