15 lines
433 B
Rust
15 lines
433 B
Rust
use rplidar_rs::Lidar;
|
|
use std::time::Duration;
|
|
|
|
fn main() {
|
|
let serial = serialport::new("/dev/cu.usbserial-0001", 115200)
|
|
.timeout(Duration::from_secs(10))
|
|
.open_native()
|
|
.expect("Failed to open serial port, check it's available");
|
|
let mut lidar = Lidar::new(serial);
|
|
lidar.start_scanning().expect("Failed to start scanning");
|
|
for scan in lidar {
|
|
println!("{}", scan.len());
|
|
}
|
|
}
|