Skip to content

Commit

Permalink
Correct example in Readme (closes #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
little-arhat committed Jan 6, 2024
1 parent cbb790e commit e239bef
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ version = "<version>"
Use embedded-hal implementation to get I2C handle and delay then create vl53l0x handle:

```rust
extern crate vl53l0x; // or just use vl53l0x; if 2018 edition is used.
use vl53l0x;

// to create sensor with default configuration:
let mut lsm = VL53L0X::default(l2c, &mut delay)?;
// to get all supported measurements:
let all = marg.all()?;
println!("{:?}", all);
// to create sensor with i2c:

let mut tof = vl53l0x::VL53L0x::new(i2c).expect("tof");
tof.set_measurement_timing_budget(200000).expect("time budget");
tof.start_continuous(0).expect("start");
let mls = tof.read_range_continuous_millimeters();
println!("{}", mls);
```

## More examples
Expand Down

0 comments on commit e239bef

Please sign in to comment.