println in arduino - prints data out in serial monitor
but in rust, the data conversion errors are happening.
since this is more embedded problem, here no std libs are allowed.
hence provide an example for rp-hal - serial monitor for all data types.
examples are available as only for bytes
serial.write(b"Helloworld\r\n");
when i try to pass on u8 or i8 data type - getting error
expected &[u8], found i8
If you want to write an i8 (does it come from a C signed char, by the way?), then you can just cast it to a u8 to preserve the bit pattern, and then create a single-element array from it: serial.write(&[the_i8 as u8])
you could use the Heapless (https://crates.io/crates/heapless) crate with the write! macro to write the value to a "String" and later print that "String"
use core::fmt::Write;
let mut out: String<10> = String::new();
let my_var = Sensor::read();
write!(&mut out, "{}", my_var).unwrap();
serial.write(&out)