particle-iot/particle-usb

Name: particle-usb

Owner: Particle

Description: A library for accessing Particle USB devices

Created: 2017-12-04 18:50:34.0

Updated: 2018-02-12 22:42:27.0

Pushed: 2018-02-06 00:43:09.0

Homepage:

Size: 72

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

particle-usb

Build Status

A library for accessing Particle USB devices.

Note: This library requires Particle firmware 0.8.0 or later.

Installation

Using npm:

m install particle-usb
Usage

In Node.js:

rt * as usb from 'particle-usb';
Enumerating devices
t devices = await usb.getDevices();
(let device of devices) {
nsole.log(device.type); // Prints device type, e.g. "Photon"

Opening devices

Most of the device methods, such as reset(), require the device to be open:

t devices = await usb.getDevices();
devices.length == 0) {
row new Error('No devices found');

t device = devices[0];
t device.open();
t device.reset(); // Resets the device

It is possible to open a device by ID:

t device = await usb.openDeviceById('0123456789abcdef01234567');
t device.reset();

The device should be closed when it is no longer needed:

t device.close();
API reference

For more information, read the API reference on GitHub.

License

This library is released under the Apache 2.0 license. See LICENSE for details.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.