どんどん明るくなっていくLEDなんですが、このテープ、それぞれLEDを指定して点灯できるんですね。
これLEDごとレジスタがついてる。
WS8212B データシート
シフトレジスタを使ってLEDを指定して点灯する方法がありますが、その原理です。シリアルで信号を送ってそれぞれ点灯できるわけです。それぞれ切り取って使えます。
「なんてこった」って思いましたね(笑。
Arduino 使ってつないで点灯してみたんですが、これですね。いいライブラリまで出てる。鮮やか。動きがある。並べるとイメージが違う。(実際はこの動画よりもっと鮮やかですよー)
Guide for WS2812B Addressable RGB LED Strip with Arduino
プログラムです。ライブラリはこちらです。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FastLED.h" | |
#define NUM_LEDS 12 | |
#define DATA_PIN 3 | |
CRGB leds[NUM_LEDS]; | |
int index=0; | |
static uint8_t hue; | |
void setup() { | |
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); | |
} | |
void loop() { | |
index++; | |
index=index%NUM_LEDS; | |
hue++; | |
hue=hue%256; | |
leds[(index+5)%NUM_LEDS] = CHSV((hue+30)%256,255,255); | |
leds[(index+3)%NUM_LEDS] = CHSV((hue+15)%256,255,255); | |
leds[(index+1)%NUM_LEDS] = CHSV(hue,255,255); | |
leds[index] = CRGB::Black; | |
FastLED.show(); | |
delay(300); | |
} |
これ並べたマトリックス・ディスプレイまで出てますが(まだ高いですね)、夢が広がります。