Change the way data is displayed

This commit is contained in:
Andreas Tsouchlos 2025-09-30 02:40:27 +02:00
parent 988204d9fa
commit ef6d8419d7

View File

@ -32,7 +32,7 @@ async fn main(_spawner: Spawner) {
loop { loop {
unwrap!(twi.blocking_write(ADDRESS, &mut [0xFD])); unwrap!(twi.blocking_write(ADDRESS, &mut [0xFD]));
Timer::after_millis(300).await; Timer::after_millis(10).await;
let mut buf = [0u8; 6]; let mut buf = [0u8; 6];
unwrap!(twi.blocking_read(ADDRESS, &mut buf)); unwrap!(twi.blocking_read(ADDRESS, &mut buf));
@ -42,10 +42,9 @@ async fn main(_spawner: Spawner) {
let rh_int = u16::from_be_bytes([buf[3], buf[4]]); let rh_int = u16::from_be_bytes([buf[3], buf[4]]);
let rh_float: f32 = -6f32 + 125f32 * (rh_int as f32 / (2u32.pow(16) - 1) as f32); let rh_float: f32 = -6f32 + 125f32 * (rh_int as f32 / (2u32.pow(16) - 1) as f32);
println!("temp_float: {}", temp_float); println!("{}\t{}", temp_float, rh_float);
println!("rh_float: {}", rh_float);
Timer::after_millis(1000).await; Timer::after_millis(50).await;
} }
} }