https://github.com/awk34/node-rplidar
A Node.js library for the RPLidar V1
https://github.com/awk34/node-rplidar
lidar node rplidar schemapack ws
Last synced: 2 months ago
JSON representation
A Node.js library for the RPLidar V1
- Host: GitHub
- URL: https://github.com/awk34/node-rplidar
- Owner: Awk34
- License: mit
- Created: 2016-09-30T22:38:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-08T15:46:49.000Z (almost 8 years ago)
- Last Synced: 2025-03-18T15:16:40.705Z (7 months ago)
- Topics: lidar, node, rplidar, schemapack, ws
- Language: JavaScript
- Homepage:
- Size: 201 KB
- Stars: 14
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Node.js RPLidar
## Prerequisites
Node >= 4.0.0
Tested on Windows 10 x64## Installation
```bash
npm install rplidar
```## Usage
```js
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:
```js
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');
});
```
To see how I got here, you can read this blog post: http://andrewk.me/blog/57f4933c0f9923a86cf67a19