#include /* Change LEDS to the number of your leds */ #define LEDS 43 #define PIN 3 #define RED 255 #define GREEN 64 #define BLUE 0 Adafruit_NeoPixel strip(LEDS, PIN); float SPEED[LEDS]; float getIntensity(const unsigned int *id, const unsigned long *timestamp) { return 0.1 + (cos((float)*timestamp * 0.01 * SPEED[*id]) + 1.0) * 0.45; } void setup() { strip.begin(); strip.show(); for (int s = 0; s < LEDS; s++) { SPEED[s] = (float)random(100, 1000) / 1000.0; } } void loop() { unsigned long timestamp = millis(); for (int led = 0; led < LEDS; led++) { float intensity = getIntensity(&led, ×tamp); strip.setPixelColor( led, (float)RED * intensity, (float)GREEN * intensity, (float)BLUE * intensity ); } strip.show(); delay(2); }