blinkt-kit
Pimoroni Blinkt! NodeJS bindings. Based on node-blinkt. Updated for Node > 8.
npm install blinkt-kit --save
Basic example
const Blinkt = ; const blinkt = ; blinkt;blinkt;blinkt;blinkt; // Send update applies your changes to the Blinkt!blinkt; // Switch everything off after two seconds.;
Other examples
const Blinkt COLOURS PI_RAINBOW = ; const blinkt = clearOnExit: true ;const TEST_DELAY = 1000; const showInitialAnimation = { blinkt; ; } const showFinalAnimation = { blinkt; ; } const flashPixel = { blinkt; ; } const turnAllOnWithColour = { blinkt; blinkt; ; }; const turnOnWithColour = { blinkt; blinkt; ; }; const runThrough = async { await ; await ; await ; await ; await ; await ;}; const basicColours = async { for let ix = 0 length = PI_RAINBOWlength; ix < length; ix++ await ; }; ;
API
Set an individual Blinkt! pixel to the a specific value.
Parameters | |
pixel
|
Number (optional) The Pixel to update 0 to 7 Defaults to 0 |
r
|
Number (optional) The RED value for the Pixel 0 to 255 Defaults to 0 |
g
|
Number (optional) The GREEN value for the Pixel 0 to 255 Defaults to 0 |
b
|
Number (optional) The BLUE value for the Pixel 0 to 255 Defaults to 0 |
brightness
|
Number (optional) The relative brightness for the pixel 0.0 to 1.0 Defaults to 0.2 |
Set all of the Blinkt! pixels to the same values.
Parameters | |
r
|
Number (optional) The RED value for the Pixel 0 to 255 Defaults to 0 |
g
|
Number (optional) The GREEN value for the Pixel 0 to 255 Defaults to 0 |
b
|
Number (optional) The BLUE value for the Pixel 0 to 255 Defaults to 0 |
brightness
|
Number (optional) The relative brightness for the pixel 0.0 to 1.0 Defaults to 0.2 |
Return the current state of the Blinkt! pixels.
Parameters | |
pixel
|
Number (optional) The Pixel to update 0 to 7 Defaults to 0 |
times
|
Number (optional) The number of times to flash the pixel Defaults to 0 |
intervalms
|
Number (optional) The milliseconds to pause between state changes Defaults to 0 |
r
|
Number (optional) The RED value for the Pixel 0 to 255 Defaults to 0 |
g
|
Number (optional) The GREEN value for the Pixel 0 to 255 Defaults to 0 |
b
|
Number (optional) The BLUE value for the Pixel 0 to 255 Defaults to 0 |
brightness
|
Number (optional) The relative brightness for the pixel 0.0 to 1.0 Defaults to 0.2 |
Set the brightness of all the Blinkt! pixels if no pixel specified, or the brightness for all of them if no PixelNumber specified.
Parameters | |
pixel
|
Number (optional) The pixel number 0 to 7 |
brightness
|
Number (optional) The relative brightness for the pixel 0.0 to 1.0 Defaults to 0.2 |
Show an animation that starts with two pixels in the center fading up, extends outwards at full brightness and then turns off.
Parameters | |
r
|
Number (optional) The RED value for the Pixel 0 to 255 Defaults to 0 |
g
|
Number (optional) The GREEN value for the Pixel 0 to 255 Defaults to 0 |
b
|
Number (optional) The BLUE value for the Pixel 0 to 255 Defaults to 0 |
Parameters | |
r
|
Number (optional) The RED value for the Pixel 0 to 255 Defaults to 0 |
g
|
Number (optional) The GREEN value for the Pixel 0 to 255 Defaults to 0 |
b
|
Number (optional) The BLUE value for the Pixel 0 to 255 Defaults to 0 |
Unsets all of the Blinkt! Pixels
Will undo all Blinkt! configuration and reset LEDs if the process ends or is interrupted with CTRL C.
Parameters | |
shouldClearOnExit
|
Boolean Default: true |
Importantly!
Commits all the 'set' operations to the Blinkt! (Nothing will show without this!)
Acknowledgements
-
Original python code: http://docs.pimoroni.com/blinkt/
-
Updated to use rpio for Node 12+ compatibility by Chris Kinsman