0.0.1 • Published 4 years ago

serialport-binding-webusb-ftdi232 v0.0.1

Weekly downloads
7
License
MIT
Repository
-
Last release
4 years ago

serialport-binding-webusb-ftdi232

FTDI232 Binding for webusb-serialport.

Note: Even though this binding can be used with the default serialport package, it loads the default bindings which try to initialize Linux bindings, webusb-serialport does not load any binding nor it does autodetect it.

Installation

npm install webusb-serialport serialport-binding-webusb-ftdi232

Usage

const SerialPort = require('webusb-serialport'); // Require WebUSB Serial
const FTDIBinding = require('serialport-binding-webusb-ftdi232'); // Require FTDI Binding

SerialPort.Binding = FTDIBinding; // Set the binding

SerialPort.list() // List the devices (this will trigger the WebUSB device chooser)
    .then((devices) => {
        const serialPort = new SerialPort(devices[0], {
            autoOpen: true,
            baudRate: 115200,
        });

        // Use as a serialport module
        serialPort.write('data');
    });