
#include <Adafruit_NeoPixel.h>
#define LED_PIN 3
#define LED_COUNT 24
#define HUE_RING 65536
#define HSV_MAX 255
// uint32_t rgbcolor = strip.ColorHSV(hue, saturation, brightness);
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB);
void setup(){
strip.begin();
}
void loop(){
updateLeds();
}
void updateLeds() {
for(int i=0; i<LED_COUNT; i++)
{
strip.setPixelColor(i, strip.ColorHSV(i*HUE_RING/LED_COUNT, HSV_MAX, HSV_MAX));
strip.show();
delay(100);
}
strip.clear();
strip.show();
}
Taśmy neopixel mogą być dzielone i łączone, ale należy podać ich ilość w konstruktorze

#include <Adafruit_NeoPixel.h>
#define LED_PIN 12
#define LED_COUNT 16
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB);
void setup() {
strip.begin();
}
void loop() {
updateLeds();
}
void updateLeds() {
for (int i = 0; i < LED_COUNT; i++) {
strip.setPixelColor(i, 1, 0, 0);
strip.show();
delay(100);
}
strip.clear();
strip.show();
}