Get the example working with a real lidar
This commit is contained in:
14
examples/simple_example.rs
Normal file
14
examples/simple_example.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user