As a follow-up to Yoda Speaks, we now have Yoda Lights Up. We have added a Sparkfun WS2812 Thru-Hole RGB LED to Yoda’s hand. There is a helpful Sparkfun WS2812 Hook-up guide. It allows for easy setup with the Sparkfun Papa Soundie we are using for the sound playback.
The LED is connected to Vcc/+5vdc, GND and Pin 10. We chose to use the FastLED library for our setup. There is a wiki online to answer many of your questions. As for code, our example is pretty simple:
#include <FastLED.h>
#define DATA_PIN 10
#define NUM_LEDS 1
#define LED_TYPE WS2812
#define COLOR_ORDER RGB
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
}
void loop() {
leds[0].setRGB(0,255,0);
// or
leds = CRGB::Green;
FastLED.show();
delay(30);
}
Sparkfun points to some example code and the Adafruit NeoPixel library. Additional it is also recommended to add a series resistor(220 – 470 ?) on the data line and a filter capacitor(100µF – 1000µF) across the power lines if using more than a pixel of two. If you are using a large number of pixels there is a nice article on Large Power Loads and Daisy Chained LED Strips.