0

I’m using an Arduino Uno and a fastLed WS2812B. I have the leds set up correctly. Every 2 seconds, the lights pause of about a second and display seemingly random colors.

Does anyone know what's wrong?

My code:

#include <FastLED.h>

#define LED_PIN   7
#define NUM_LEDS  10

CRGB leds[NUM_LEDS];


void setup() {
  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);

}

void loop() {
  for (int i = 0; i < NUM_LEDS; i++){
    leds[i] = CRGB(0,0,255);
    FastLED.show();
    delay(100);
  }
  for (int i = 0; i < NUM_LEDS; i++){
    leds[i] = CRGB(255,0,0);
    FastLED.show();
    delay(100);
  }
}
  • Is this on an Arduino or something else like ESP8266? – jose can u c Jan 12 at 21:36
  • It is an Arduino Uno – Wes Summers Jan 12 at 21:39
  • How are you powering the LEDs? – Majenko Jan 12 at 22:50
  • I noted that each example in fastled library, ‘’clear’’ the array, after running ‘’show’’ function. Try with: leds[i]= CRGB::Black; after ‘’show’’. – leoc7 Jan 12 at 22:57
  • what happens if you put FastLED.show(); and delay(100); after the for loop – jsotola Jan 12 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.