Skip to content

Commit

Permalink
Add linux example
Browse files Browse the repository at this point in the history
  • Loading branch information
eldruin committed Apr 5, 2020
1 parent 57b6fff commit a7934bb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions examples/linux.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extern crate linux_embedded_hal as hal;
use isl29125::{Isl29125, OperatingMode};

fn main() {
let dev = hal::I2cdev::new("/dev/i2c-1").unwrap();
let mut sensor = Isl29125::new(dev);
sensor
.set_operating_mode(OperatingMode::RedGreenBlue)
.unwrap();
loop {
let m = sensor.read().unwrap();
println!("R: {}, G: {}, B: {}", m.red, m.green, m.blue);
}
}

0 comments on commit a7934bb

Please sign in to comment.