0.2.2 • Published 1 month ago

blinkstick-ts v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

BlinkStick-TS

TypeScript implementation of BlinkStick. Also, a bit of a reimagination of the API.

Installation

npm install blinkstick-ts

Examples

See Examples at GitHub

Run with

npx ts-node src/examples/basic.ts

Object-Orientied API

A BlinkStick provides access to multiple LEDs potentially organized in multiple channels (i.e. lines of LEDs). To make it easier to work with those constructs and not just arbitrary indexes, there is an LedLine and Led object.

const ledLine: LedLine = blinkstick.getChannel(0);
const led1: Led = channel.getLed(0);
const led2: Led = channel.getLed(1);

Functional API

An alternative to the object-oriented API is the functional API. Here, it's all functions, no objects. Simple to start with.

setColor(0, Colors.red);
setColors([Colors.red, Colors.green]);

German version

There is also a german variant of the functional API.

setzeFarbe(0, Farben.Rot);
setzeFarben([Farben.Rot, Farben.Grün]);

Simulator

You can use simulated led lines and print to the terminal

████████████████████████████████
████████████████████████████████
████████████████████████████████
████████████████████████████████
████████████████████████████████
██
0.2.1

1 month ago

0.2.2

1 month ago

0.2.0

4 months ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago