Skip to content

Commit 44366d0

Browse files
committed
initial commit
0 parents  commit 44366d0

11 files changed

+513
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text eol=lf

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
*.log

.npmignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
examples/
2+
test/
3+
.*
4+
AUTHORS.md
5+
CHANGES.md
6+
CONTRIBUTING.md
7+
README.md

AUTHORS.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Authors ordered by first contribution
2+
3+
* Alasdair Mercer <[email protected]>

CONTRIBUTING.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Contributing
2+
3+
If you have any questions about [Blinkt](https://github.com/NotNinja/node-blinkt) please feel free to
4+
[raise an issue](https://github.com/NotNinja/node-blinkt/issues/new).
5+
6+
Please [search existing issues](https://github.com/NotNinja/node-blinkt/issues) for the same feature and/or issue before
7+
raising a new issue. Commenting on an existing issue is usually preferred over raising duplicate issues.
8+
9+
You must have [Node.js](https://nodejs.org) installed.
10+
11+
All pull requests should be made to the `develop` branch.
12+
13+
Don't forget to add your details to the list of
14+
[AUTHORS.md](https://github.com/NotNinja/node-blinkt/blob/master/AUTHORS.md) if you want your contribution to be
15+
recognized by others.

LICENSE.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (C) 2017 Alasdair Mercer, !ninja
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
888888b. 888 d8b 888 888 888
2+
888 "88b 888 Y8P 888 888 888
3+
888 .88P 888 888 888 888
4+
8888888K. 888 888 88888b. 888 888 888888 888
5+
888 "Y88b 888 888 888 "88b 888 .88P 888 888
6+
888 888 888 888 888 888 888888K 888 Y8P
7+
888 d88P 888 888 888 888 888 "88b Y88b. "
8+
8888888P" 888 888 888 888 888 888 "Y888 888
9+
10+
[Blinkt](https://github.com/NotNinja/node-blinkt) is Node.js library that allows you to interact with your Blinkt
11+
hardware:
12+
13+
https://shop.pimoroni.com/products/blinkt
14+
15+
[![Dependency Status](https://img.shields.io/david/NotNinja/node-blinkt.svg?style=flat-square)](https://david-dm.org/NotNinja/node-blinkt)
16+
[![License](https://img.shields.io/npm/l/blinkt.svg?style=flat-square)](https://github.com/NotNinja/blinkt/blob/master/LICENSE.md)
17+
[![Release](https://img.shields.io/npm/v/blinkt.svg?style=flat-square)](https://www.npmjs.com/package/blinkt)
18+
19+
* [Install](#install)
20+
* [API](#api)
21+
* [Bugs](#bugs)
22+
* [Contributors](#contributors)
23+
* [License](#license)
24+
25+
## Install
26+
27+
Install using `npm`:
28+
29+
``` bash
30+
$ npm install --save blinkt
31+
```
32+
33+
## API
34+
35+
### Set A Single Pixel
36+
37+
The bread and butter of Blintk! is setting pixels. You can set any of the 8 pixels on your Blinkt! to one of around 16
38+
million colors!
39+
40+
The `brightness` argument is completely optional. Omit it to keep the last brightness value set for that particular
41+
pixel.
42+
43+
``` javascript
44+
blinkt.setPixel(index, red, green, blue, brightness)
45+
```
46+
47+
| Parameter | Description | Required |
48+
| ---------- | ------------------------------------------------------------------ | -------- |
49+
| index | The horizontal position of the pixel (between 0 and 7 - inclusive) | Yes |
50+
| red | The amount of red to be set (between 0 and 255 - inclusive) | Yes |
51+
| green | The amount of green to be set (between 0 and 255 - inclusive) | Yes |
52+
| blue | The amount of blue to be set (between 0 and 255 - inclusive) | Yes |
53+
| brightness | The brightness to be set (between 0 and 1 - inclusive) | No |
54+
55+
### Set All Pixels
56+
57+
Sometimes you need to set all the pixels to the same color. This convenience method does just that!
58+
59+
The `brightness` argument is completely optional. Omit it to keep the last brightness values set for each pixel.
60+
61+
``` javascript
62+
blinkt.setPixels(red, green, blue, brightness)
63+
```
64+
65+
| Parameter | Description | Required |
66+
| ---------- | ------------------------------------------------------------- | -------- |
67+
| red | The amount of red to be set (between 0 and 255 - inclusive) | Yes |
68+
| green | The amount of green to be set (between 0 and 255 - inclusive) | Yes |
69+
| blue | The amount of blue to be set (between 0 and 255 - inclusive) | Yes |
70+
| brightness | The brightness to be set (between 0 and 1 - inclusive) | No |
71+
72+
### Show
73+
74+
None of your pixels will appear on Blinkt! until you `show()` them. This method writes all the pixel data out to your
75+
device.
76+
77+
``` javascript
78+
blinkt.show()
79+
```
80+
81+
### Clear
82+
83+
Exactly the same as calling `setAll(0,0,0)`, clear sets all the pixels to black.
84+
85+
You must also call `show()` if you want to turn Blinkt! off.
86+
87+
``` javascript
88+
blinkt.clear()
89+
```
90+
91+
### Enable/Disable Clear On Exit
92+
93+
Sometimes you want a script that runs and quits, leaving a pattern up on Blinkt!
94+
95+
``` javascript
96+
blinkt.setClearOnExit(value)
97+
```
98+
99+
| Parameter | Description | Required |
100+
| --------- | ------------------------------------------------- | -------- |
101+
| value | `true` to clear pixels on exit; otherwise `false` | No |
102+
103+
### Get A Single Pixel
104+
105+
Returns the colors and brightness for a particular pixel.
106+
107+
``` javascript
108+
blinkt.getPixel(index)
109+
```
110+
111+
| Parameter | Description | Required |
112+
| --------- | ------------------------------------------------------------------ | -------- |
113+
| index | The horizontal position of the pixel (between 0 and 7 - inclusive) | Yes |
114+
115+
### Constants
116+
117+
Blinkt! has 8 pixels. Simple. Use the constant `NUM_PIXELS` when you’re iterating over pixels, so you can avoid a *magic
118+
number* in your code.
119+
120+
``` javascript
121+
blinkt.NUM_PIXELS
122+
```
123+
124+
## Bugs
125+
126+
If you have any problems with using this library or would like to see changes currently in development you can do so
127+
[here](https://github.com/NotNinja/node-blinkt/issues).
128+
129+
If you believe that you are experiencing issues with your Blinkt hardware, then you
130+
[get help](http://forums.pimoroni.com/c/support).
131+
132+
## Contributors
133+
134+
If you want to contribute, you're a legend! Information on how you can do so can be found in
135+
[CONTRIBUTING.md](https://github.com/NotNinja/node-blinkt/blob/master/CONTRIBUTING.md). We want your suggestions and
136+
pull requests!
137+
138+
A list of Blinkt contributors can be found in
139+
[AUTHORS.md](https://github.com/NotNinja/node-blinkt/blob/master/AUTHORS.md).
140+
141+
## License
142+
143+
See [LICENSE.md](https://github.com/NotNinja/node-blinkt/raw/master/LICENSE.md) for more information on our MIT license.
144+
145+
[![Copyright !ninja](https://cdn.rawgit.com/NotNinja/branding/master/assets/copyright/base/not-ninja-copyright-186x25.png)](https://not.ninja)

examples/.gitignore

Whitespace-only changes.

package.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "blinkt",
3+
"version": "0.1.0",
4+
"description": "Module for interacting with the Raspberry Pi Blinkt! addon",
5+
"homepage": "https://github.com/NotNinja/node-blinkt",
6+
"bugs": {
7+
"url": "https://github.com/NotNinja/node-blinkt/issues"
8+
},
9+
"author": {
10+
"name": "Alasdair Mercer",
11+
"email": "[email protected]",
12+
"url": "https://not.ninja"
13+
},
14+
"license": "MIT",
15+
"keywords": [
16+
"raspberry",
17+
"pi",
18+
"gpio",
19+
"blinkt",
20+
"led",
21+
"rgb"
22+
],
23+
"repository": {
24+
"type": "git",
25+
"url": "https://github.com/NotNinja/node-blinkt.git"
26+
},
27+
"dependencies": {
28+
"rpio": "^0.9.16"
29+
},
30+
"main": "src/blinkt.js"
31+
}

0 commit comments

Comments
 (0)