ez-serial-read
the serialport package easier.
A package that makes the usage ofThis package was made to make reading an Arduino serial comm easier as normally you have to write many lines of code and end up getting a buffer instead of a string.
Install:
> npm i --save ez-serial-read
Usage:
(Arguments prefixed with ?
are optional and will have a default value)
var success =
Example:
const ezSerial = ; var success = ; ifsuccess // the ezSerial() function returns a boolean value that is true, if the connection could be established and false, if not console;else console;
If you don't know your COM ports, use this:
const ezSerial = ; ezSerial;
This lists all serial ports to the console. It will look something like this:
comName: 'COM3' manufacturer: 'FTDI' serialNumber: 'A702H5DS' pnpId: 'FTDIBUS\\VID_0403+PID_6001+A702H5DSA\\0000' locationId: undefined vendorId: '0403' productId: '6001' comName: 'COM1' manufacturer: '(Standard port types)' serialNumber: undefined pnpId: 'ACPI\\PNP0501\\0' locationId: undefined vendorId: undefined productId: undefined comName: 'COM4' // <- <- <- <- this is the actual port of our arduino we want to talk to, so we need to enter "COM4" in the initialization function manufacturer: 'Arduino LLC (www.arduino.cc)' serialNumber: '85633323530351905232' pnpId: 'USB\\VID_2341&PID_0043\\85633323530351905232' locationId: 'Port_#0003.Hub_#0003' vendorId: '2341' productId: '0043'