Added LM35

This commit is contained in:
Zachary Sunforge
2023-07-18 22:26:01 -07:00
parent 5e46116976
commit c2c9348c3c

View File

@ -88,11 +88,11 @@ async fn main(spawner: Spawner) {
ads_1256.self_calibrate(&mut spi).await.unwrap();
loop {
let gain = Gain::X2;
let gain = Gain::X4;
let reference = ads_1256
.autocal_convert(
&mut spi,
Differential::AIn0.into(),
SingleEnded::AIn2.into(),
None,
Some(AUTOCAL_CONF.ad_control.with_gain(gain)),
None,
@ -103,13 +103,13 @@ async fn main(spawner: Spawner) {
.to_voltage(gain);
let reference = lm35::convert(reference).unwrap();
let reference_celsius = reference.get::<degree_celsius>();
info!("Reference junction temperature in degrees celsius: {}", reference_celsius);
info!("Reference junction temperature: {}°C", reference_celsius);
let gain = Gain::X64;
let voltage = ads_1256
.autocal_convert(
&mut spi,
Differential::AIn1.into(),
Differential::AIn0.into(),
None,
Some(AUTOCAL_CONF.ad_control.with_gain(gain)),
None,
@ -121,6 +121,6 @@ async fn main(spawner: Spawner) {
let mv = voltage.get::<millivolt>();
let temperature = thermocouple_k::convert_direct(voltage, reference).unwrap();
let celsius = temperature.get::<degree_celsius>();
info!("Thermocouple temperature in degrees celsius: {}, millivolts: {}", celsius, mv);
info!("Thermocouple temperature: {}°C, millivolts: {}", celsius, mv);
}
}