Hi
I have a WS2812B, 144pixel/meter strip. In my application it is formed to make a ring.
I would like to rotate 25 PIXELS around the ring (white only ) like a running light effect.
I am using FASTLED library.
Could someone help me to create the code.
the code i have is stuck at the end and then it restarts
below is my code
#include "FastLED.h"
int LED_BAR =25;
int total =0;
// How many leds are in the strip?
#define NUM_LEDS 144
// Data pin that led data will be written out over
#define DATA_PIN 22
// Clock pin only needed for SPI based chipsets when not using hardware SPI
//#define CLOCK_PIN 8
// This is an array of leds. One item for each led in your strip.
CRGB leds[NUM_LEDS];
// This function sets up the ledsand tells the controller about them
void setup() {
// sanity check delay - allows reprogramming if accidently blowing power w/leds
delay(2000);
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
}
// This function runs over and over, and is where you do the magic to light
// your leds.
void loop() {
// Move a 25 pixels white led
for (int t=0; t < NUM_LEDS; t++) {
total =t;
LED_BAR++;
for(int whiteLed = total; whiteLed < LED_BAR; whiteLed = whiteLed + 1) {
// Turn our current led on to white, then show the leds
leds[whiteLed] = CRGB::White;
}
FastLED.show();
delay(10);
// Wait a little bit
for (int blackLed = total; blackLed < LED_BAR; blackLed++) {
// Turn our current led back to black for the next loop around
leds[blackLed] = CRGB::Black;
}
}
}
Thanks