node-blink1
Advanced tools
Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "node-blink1", | ||
"description": "A Node.js library for the blink(1).", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": { | ||
@@ -10,2 +10,5 @@ "name": "Sandeep Mistry", | ||
}, | ||
"contributors": [ | ||
"Tod Kurt <todbotdotcom@gmail.com> (https://github.com/todbot)" | ||
], | ||
"license": "MIT", | ||
@@ -24,3 +27,3 @@ "repository": { | ||
"dependencies": { | ||
"node-hid": "~0.5.0" | ||
"node-hid": "~0.7.3" | ||
}, | ||
@@ -27,0 +30,0 @@ "devDependencies": { |
120
README.md
@@ -1,6 +0,3 @@ | ||
node-blink1 | ||
=========== | ||
# node-blink1 | ||
[![Analytics](https://ga-beacon.appspot.com/UA-56089547-1/sandeepmistry/node-blink1?pixel)](https://github.com/igrigorik/ga-beacon) | ||
A Node.js library for the | ||
@@ -12,42 +9,31 @@ [blink(1)](http://www.kickstarter.com/projects/thingm/blink1-the-usb-rgb-led) | ||
Install | ||
------- | ||
**Note**: Make sure no other programs, including [Blink1Control](https://blink1.thingm.com/blink1control/) are open and using the blink(1). | ||
npm install node-blink1 | ||
## Install | ||
### Windows Users | ||
```sh | ||
npm install node-blink1 | ||
``` | ||
`node-blink1` depends on `node-hid`, a native module that uses `node-gyp` to | ||
build. `node-gyp` requires Python 2.7.3 in the PATH, and if you have Python 3 | ||
installed, you may have to modify your PATH for `node-gyp` to locate it. | ||
### Linux Users | ||
See [issue #3](https://github.com/sandeepmistry/node-blink1/issues/3) for | ||
details. | ||
See [node-hid's compiling from source instructions](https://github.com/node-hid/node-hid#compiling-from-source) | ||
### Linux Users | ||
## Usage | ||
If you encounter the following error while installing, you'll need new install | ||
of `libusb`. | ||
```javascript | ||
var Blink1 = require('node-blink1'); | ||
``` | ||
libusb.h: No such file or directory compilation terminated. | ||
``` | ||
For Debian and Ubuntu, install the package `libusb-1.0-0.dev`. | ||
See [issue #4](https://github.com/sandeepmistry/node-blink1/issues/4) for | ||
details. | ||
Usage | ||
----- | ||
var Blink1 = require('node-blink1'); | ||
Get list of blink(1) devices connected: | ||
Blink1.devices(); // returns array of serial numbers | ||
```javascript | ||
Blink1.devices(); // returns array of serial numbers | ||
``` | ||
Create blink(1) object without serial number, uses first device: | ||
var blink1 = new Blink1(); | ||
```javascript | ||
var blink1 = new Blink1(); | ||
``` | ||
@@ -57,54 +43,77 @@ Create blink(1) object with serial number, to get list of serial numbers use | ||
var blink1 = new Blink1(serialNumber); | ||
```javascript | ||
var blink1 = new Blink1(serialNumber); | ||
``` | ||
Get version: | ||
### Get version | ||
blink1.version(callback(version)); | ||
```javascript | ||
blink1.version(callback(version)); | ||
``` | ||
__Set colors__ | ||
### Set colors | ||
Fade to RGB, optional callback called after `fadeMillis` ms: | ||
blink1.fadeToRGB(fadeMillis, r, g, b, [callback]); // r, g, b: 0 - 255 | ||
```javascript | ||
blink1.fadeToRGB(fadeMillis, r, g, b, [callback]); // r, g, b: 0 - 255 | ||
blink1.fadeToRGB(fadeMillis, r, g, b, [index, callback]); // r, g, b: 0 - 255 | ||
// index (mk2 only): 0 - 2 | ||
blink1.fadeToRGB(fadeMillis, r, g, b, [index, callback]); // r, g, b: 0 - 255 | ||
// index (mk2 only): 0 - 2 | ||
``` | ||
Set RGB: | ||
blink1.setRGB(r, g, b, [callback]); // r, g, b: 0 - 255 | ||
```javascript | ||
blink1.setRGB(r, g, b, [callback]); // r, g, b: 0 - 255 | ||
``` | ||
Get RGB (mk2 only): | ||
blink1.rgb([index,] callback(r, g, b)); | ||
```javascript | ||
blink1.rgb([index,] callback(r, g, b)); | ||
``` | ||
Off: | ||
blink1.off([callback]); | ||
```javascript | ||
blink1.off([callback]); | ||
``` | ||
__Other methods__ | ||
### Other methods | ||
Set server down (enable, disable), optional callback called after `millis` ms: | ||
blink1.enableServerDown(millis, [callback]) // tickle | ||
```javascript | ||
blink1.enableServerDown(millis, [callback]); // tickle | ||
blink1.disableServerDown(millis, [callback]) // off | ||
blink1.disableServerDown(millis, [callback]); // off | ||
``` | ||
Play (start playing the pattern lines at the specified position): | ||
blink1.play = function(position, [callback]) | ||
```javascript | ||
blink1.play(position, [callback]); | ||
``` | ||
Play Loop (start playing a subset of the pattern lines at specified start and end positions. Specifying count = 0 will loop pattern forever): | ||
blink1.playLoop = function(startPosition, endPosition, count, [callback]) | ||
```javascript | ||
blink1.playLoop(startPosition, endPosition, count, [callback]); | ||
``` | ||
Pause (stop playing the pattern line): | ||
blink1.pause = function([callback]) | ||
```javascript | ||
blink1.pause([callback]); | ||
``` | ||
Write pattern line (set the parameters for a pattern line, at the specified position): | ||
blink1.writePatternLine(fadeMillis, r, g, b, position, [callback]) // r, g, b: 0 - 255 | ||
```javascript | ||
blink1.writePatternLine(fadeMillis, r, g, b, position, [callback]) // r, g, b: 0 - 255 | ||
```` | ||
A simple example of this, used to flash red on & off is: | ||
```javascript | ||
@@ -118,12 +127,15 @@ blink1.writePatternLine(200, 255, 0, 0, 0); | ||
blink1.readPatternLine(position, [callback]) | ||
```javascript | ||
blink1.readPatternLine(position, [callback]) | ||
``` | ||
Close (the underlying HID device): | ||
blink1.close([callback]); | ||
```javascript | ||
blink1.close([callback]); | ||
``` | ||
License | ||
======== | ||
## License | ||
Copyright (C) 2014 Sandeep Mistry <sandeep.mistry@gmail.com> | ||
Copyright (C) 2015 Sandeep Mistry <sandeep.mistry@gmail.com> | ||
@@ -146,1 +158,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
[![Analytics](https://ga-beacon.appspot.com/UA-56089547-1/sandeepmistry/node-blink1?pixel)](https://github.com/igrigorik/ga-beacon) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
157
43844
6
1
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addeddecompress-response@4.2.1(transitive)
+ Addedexpand-template@2.0.3(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedmimic-response@2.1.0(transitive)
+ Addedmkdirp-classic@0.5.3(transitive)
+ Addednapi-build-utils@1.0.2(transitive)
+ Addednode-hid@0.7.9(transitive)
+ Addedprebuild-install@5.3.6(transitive)
+ Addedpump@3.0.2(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsimple-get@3.1.1(transitive)
+ Addedtar-fs@2.1.1(transitive)
+ Addedtar-stream@2.2.0(transitive)
- Removedbl@1.2.3(transitive)
- Removedbuffer-alloc@1.2.0(transitive)
- Removedbuffer-alloc-unsafe@1.1.0(transitive)
- Removedbuffer-fill@1.0.0(transitive)
- Removeddecompress-response@3.3.0(transitive)
- Removedexpand-template@1.1.1(transitive)
- Removedmimic-response@1.0.1(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removednode-hid@0.5.7(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedprebuild-install@2.5.3(transitive)
- Removedpump@1.0.32.0.1(transitive)
- Removedsimple-get@2.8.2(transitive)
- Removedtar-fs@1.16.3(transitive)
- Removedtar-stream@1.6.2(transitive)
- Removedto-buffer@1.1.1(transitive)
- Removedxtend@4.0.2(transitive)
Updatednode-hid@~0.7.3