extern crate ev3dev_lang_rust;
use ev3dev_lang_rust::Attribute;
use ev3dev_lang_rust::Ev3Result;
fn main() -> Ev3Result<()> {
let color_sensor_value = Attribute::from_path_with_discriminator(
"/sys/class/lego-sensor",
"value0",
"driver_name",
"lego-ev3-color",
)?;
let rotation_count = Attribute::from_path_with_discriminator(
"/sys/bus/iio/devices",
"in_count0_raw",
"name",
"ev3-tacho",
)?;
loop {
println!(
"value0 of color sensor: {}",
color_sensor_value.get::<i32>()?
);
println!("Raw rotation count: {}", rotation_count.get::<i32>()?);
std::thread::sleep(std::time::Duration::from_secs(1));
}
}