Skip to content

Awk34/node-rplidar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js RPLidar

Prerequisites

Node >= 4.0.0 Tested on Windows 10 x64

Installation

npm install rplidar

Usage

const RPLidar = require('rplidar');

const lidar = new RPLidar();

lidar.on('data', console.log);

lidar.init().then(() => {
    return lidar.getHealth();
}).then(health => {
    console.log('health: ', health);

    return lidar.getInfo();
}).then(info => {
    console.log('info: ', info);

    return lidar.scan();
}).then(() => {
    console.log('started scanning');
});

With ES2017:

const RPLidar = require('rplidar');

const lidar = new RPLidar();

lidar.on('data', console.log);

lidar.init().then(async () => {
    let health = await lidar.getHealth();
    console.log('health: ', health);
    
    let info = await lidar.getInfo();
    console.log('info: ', info);
    
    await lidar.scan();
    console.log('started scanning');
});

screenshot

To see how I got here, you can read this blog post: http://andrewk.me/blog/57f4933c0f9923a86cf67a19

Releases

No releases published

Packages

No packages published