0.0.1 • Published 4 years ago

grbl-stream v0.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

grbl-stream

Stream based Grbl command parser and serializer. At the moment only supports a subset of commands. Tested with Grbl version 1.1f.

npm install grbl-stream

Usage

The protocol stream can be used with any stream based transport, e.g. using with serialport.

const SerialPort = require('serialport')
const { GrblStream } = require('grbl-stream')

const port = new SerialPort('/dev/tty.usbmodem', { baudRate: 115200 })
const grbl = new GrblStream()

grbl.pipe(port).pipe(grbl)
  .on('command', cmd => console.log('>', cmd))
  .on('message', msg => console.log('<', msg))

console.log('status', await grbl.status())
console.log('help', await grbl.help())
console.log('settings', await grbl.settings())

await grbl.runHomingCycle()
await grbl.killAlarmLock()
await grbl.metricCoordinates()
await grbl.incrementalPositioning()
await grbl.position({ x: -100, y: -100 })