obniz
Version:
obniz sdk for javascript
74 lines (64 loc) • 1.65 kB
Markdown
Full color LED driver.
Not only one LED. Capable of chaining leds.

WS2812B is embed in various Full Color LEDs.
connect VDD and GND to obniz and drive it.
And, wire DIN(Data in) to obniz. and write a code below
```Javascript
// Javascript Example
var leds = obniz.wired("WS2812B", {gnd:0, vcc: 1, din: 2});
leds.rgbs([
[], // red
[] // blue
])
```
vcc and gnd is optional
```Javascript
// Javascript Example
var led = obniz.wired("WS2812B", {din: 2});
```
change color.
When you chaining LED, this will change only top of leds.
```Javascript
// Javascript Example
var led = obniz.wired("WS2812B", {gnd:0, vcc: 1, din: 2});
led.rgb(0xFF, 255, 0); // Yellow
```
change color from hsv values.
When you chaining LED, this will change only top of leds.
hue : 0 ~ 360
saturation : 0 ~ 1
value : 0 ~ 1
```Javascript
// Javascript Example
var led = obniz.wired("WS2812B", {gnd:0, vcc: 1, din: 2});
led.hsv(180, 0.5, 1);
```
change colors.
You can specify colors of chained leds.
max chain length is 85(It depends on SPI max length)
```Javascript
// Javascript Example
var led = obniz.wired("WS2812B", {gnd:0, vcc: 1, din: 2});
led.rgbs([
[], // red
[] // blue
])
```
change colors.
You can specify colors of chained leds.
max chain length is 85(It depends on SPI max length)
```Javascript
// Javascript Example
var led = obniz.wired("WS2812B", {gnd:0, vcc: 1, din: 2});
led.hsvs([
[],
[]
])
```