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
Size: 72
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A library for accessing Particle USB devices.
Note: This library requires Particle firmware 0.8.0 or later.
Using npm:
m install particle-usb
In Node.js:
rt * as usb from 'particle-usb';
t devices = await usb.getDevices();
(let device of devices) {
nsole.log(device.type); // Prints device type, e.g. "Photon"
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();
For more information, read the API reference on GitHub.
This library is released under the Apache 2.0 license. See LICENSE for details.