Skip to content

ireneea/web-serial-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

web-serial-utils

Utility to connect and use serial devices using the Web Serial API

TODO

  • Feature detection
  • Connect a device
  • Read from a serial port
  • Write to a serial port
  • Close a serial port
  • Listen to connection and disconnection
  • Handle signals
  • Transforming streams
  • Revoke access to a serial port

Feature detection

import { isWebSerialSupported } from "web-serial-utils"

if (isWebSerialSupported) {
    // Use other util functions (connect, read, write...)
} else {
    // Fallback logic
}

Connect to a device

import { connectToDevice } from "web-serial-utils";

const arduinoDevice = await connectToDevice({
  // Arduino Uno USB example
  targetDevice: {
    usbProductId: 0x1234,
    usbVendorId: 0x5678,
  },
  connectionOptions: {
    baudRate: 9600,
  },
});

Resources

About

Utility to conncet and use serial devices using the Web Serial API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published