node-serialport-bindings-cpp/packages/repl
Francis Gulotta 6b85c3d719 chore: rename comName to path (#1859)
We refer to the data as path everywhere but the port info object. This unifies them.

Accessing `comName` will log a warning for one major release and go away afterwards.
2019-05-03 23:20:59 -04:00
..
lib chore: rename comName to path (#1859) 2019-05-03 23:20:59 -04:00
.npmignore feat: move cli tools to their own packages (#1664) 2018-09-15 04:58:28 -04:00
CHANGELOG.md Publish 2019-04-27 10:36:11 -04:00
LICENSE feat: move cli tools to their own packages (#1664) 2018-09-15 04:58:28 -04:00
package.json chore: remove node6 support and upgrade codebase (#1851) 2019-05-01 21:19:29 -04:00
README.md feat: move cli tools to their own packages (#1664) 2018-09-15 04:58:28 -04:00

SerialPort Repl

$ npx @serialport/repl <port>
# or
$ npm install -g @serialport/repl
$ serialport-repl <port>

The package @serialport/repl will install the serialport-repl cli tool which provides a nodejs repl for working with serialport. This is valuable when debugging.

You can make use of the serialport-repl command with;

$ serialport-repl # to auto detect an arduino
$ serialport-repl /dev/tty.usbmodem1421 # to connect to a specific port

It will load a serialport object with debugging turned on.

$ serialport-repl
  serialport:binding:auto-detect loading DarwinBinding +0ms
port = SerialPort("/dev/tty.usbmodem1421", { autoOpen: false })
globals { SerialPort, portName, port }
> SerialPort.list()
  serialport:main .list +6s
[ { comName: '/dev/tty.usbmodem1421',
    manufacturer: 'Arduino (www.arduino.cc)',
    serialNumber: '752303138333518011C1',
    pnpId: undefined,
    locationId: '14200000',
    vendorId: '2341',
    productId: '0043' } ]
> port.write('Calling all Autobots!')
true
> port.read()
  serialport:main _read queueing _read for after open +1m
null
> port.open()
  serialport:main opening path: /dev/tty.usbmodem1421 +30s
  serialport:bindings open +1ms