neopixel-cousu.ino
Flora/WS2812 addressable LEDs run on a single pin with the Adafruit_NeoPixel library; the rainbow effect slowly rotates. At 3.3 V, feed the strip from the V-REG pad with a charged LiPo (≈3.9-4.2 V).
Hardware required
A LilyPad Arduino (ATmega168V/328V, 8 MHz, 3.3 V) with its sew tabs, programmed via an FTDI cable (breakout) and powered by 3.7 V (LiPo) or 5 V on V-REG. 8 addressable LEDs (Flora pixels or WS2812) + conductive thread.
Wiring
DIN to pin 6, VCC to V-REG, GND to GND; 300-470 µF capacitor across the LED supply.
How it works
setPixelColor fills the buffer, show() emits the timing stream on the single pin. Brightness is capped for battery life. In the Arduino IDE, select « LilyPad Arduino » and the FTDI port, then Upload. Conductive thread adds a few ohms of resistance: keep runs short and insulate crossings.
Going further
React to a sensor (LDR, tilt) to change the palette, or animate a pattern driven by a button.
neopixel-cousu.ino
// 8 NeoPixel (Flora/WS2812) sur la broche 6, effet arc-en-ciel.
#include <Adafruit_NeoPixel.h>
#define PIN 6
#define N 8
Adafruit_NeoPixel strip(N, PIN, NEO_GRB + NEO_KHZ800);
int decalage = 0;
void setup() {
strip.begin();
strip.setBrightness(60); // menage la batterie
strip.show();
}
void loop() {
for (int i = 0; i < N; i++) {
uint8_t teinte = map(i * 256 / N + decalage, 0, 256, 0, 255);
strip.setPixelColor(i, strip.ColorHSV(teinte * 256));
}
strip.show();
decalage = (decalage + 3) % 256;
delay(30);
}