New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

serial-nci-scale

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serial-nci-scale

Serial interface for Salter Brecknell PS-USB scales using NCI protocol and SCP-12 layout

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

Serial NCI Scale

An API to query a Serial Scale which supports the NCI protocal (SCP-12, NCI 3825, NCI 3835). Tested against the Salter Brecknell PS-USB scale. Depends on the Web Serial API.

Getting Started

Page Hosting the library must be served over HTTPS. Demo is available at https://chris-rudmin.github.io/serial-nci-scale/

Installation

npm install serial-nci-scale --save

Instance Methods

  • getWeight() - Returns a promise which resolves with scale weight data. Required to be called from user action
  • getStatus() - Returns a promise which resolves with scale status data. Required to be called from user action
  • zero() - Returns a promise which resolves when the scale is zeroed. Required to be called from user action
  • startPolling() - Starts polling the scale for weight data every 250ms. Required to be called from user action
  • stopPolling() - Stops polling the scale
  • disconnect() - Returns a promise which resolves once disconnected. Closes the read and write streams and frees the serial port

Example

import SerialNCIScale from 'serial-nci-scale';

const scale = new SerialNCIScale();
const { weight, units, status } = await scale.getWeight();

Events

The serial-nci-scale instance is an EventTarget and can be listened to for custom events. Scale data is contained the in the detail property.

  • weight - Dispatched for every weight read
  • status - Dispatched for every status read
  • settled - Dispatched when the scale is no longer in motion and if the weight is different than the last settled weight

Supported Browsers

Currently only Chrome 89+ supports the Web Serial API. Earlier versions of Chrome can use the API if it is enabled in chrome://flags

Keywords

FAQs

Package last updated on 13 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc