grbl-stream

Stream based Grbl command parser and serializer

Usage no npm install needed!

<script type="module">
  import grblStream from 'https://cdn.skypack.dev/grbl-stream';
</script>

README

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 })