use linux_embedded_hal as hal;
use grideye::{Address, GridEye, Power};
use crate::hal::I2cdev;
use std::{thread, time};
fn main() -> Result<(), std::io::Error> {
println!("GridEye Example");
let i2c = I2cdev::new("/dev/i2c-1").unwrap();
let mut grideye = GridEye::new(i2c, Address::Standard);
grideye.power(Power::Wakeup).unwrap();
println!(
"device temperature: {}",
grideye.get_device_temperature_celsius().unwrap()
);
loop {
println!("-------------------------------------------------------------------------");
for x in 0..8 {
for y in 0..8 {
let pixel = (x * 8) + y;
let temp = grideye.get_pixel_temperature_celsius(pixel).unwrap();
print!("{}", temp);
if y < 7 {
print!(";");
}
}
println!("");
}
let sleeptime = time::Duration::from_secs(5);
thread::sleep(sleeptime);
}
}