Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

Commit

Permalink
Update README to reflect API changes (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Nov 6, 2015
1 parent 51a16e5 commit 129fe78
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,22 @@ Capture some pictures:
extern crate touptek;

fn main() {
let cam = touptek::Toupcam::open(None);
cam.start(
|event| {
match event {
let cam = touptek::Toupcam::open(None).
expect("Need a connected camera!");
cam.start(|event_rx| {
loop {
match event_rx.recv().unwrap() {
touptek::Event::Image => {
let image = cam.pull_image(8);
println!("captured a {}x{} image",
image.width, image.height);
image.resolution.width, image.resolution.height);
println!("first pixel: r {} g {} b {}",
image.data[0], image.data[1], image.data[2])
},
_ => ()
},
},
|| {
// images will be captured until this closure returns
std::thread::sleep_ms(5000);
_ => break
}
}
);
});
}
```

Expand Down

0 comments on commit 129fe78

Please sign in to comment.