pmw3901 1.0.0

Library for the PMW3901 optical flow sensor.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
extern crate pmw3901;
use std::thread;
use std::time;

fn main() {
    let mut pmw3901 = pmw3901::Pmw3901::new(0, 0).unwrap();
    pmw3901.init().unwrap();

    loop {
        let sample = pmw3901.read_sample().unwrap();
        println!("x: {}, y: {}", sample.x, sample.y);
        thread::sleep(time::Duration::from_millis(100));
    }
}