Go Down

Topic: WS2812 turn on and off not in same time (Read 230 times) previous topic - next topic

bledhuk

greetings....

my code
Code: [Select]

#include <FastLED.h>
#define NUM_LEDS 60
#define DATA_PIN 6

CRGB leds[NUM_LEDS];

void setup() {
  // put your setup code here, to run once:
  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  FastLED.clear();
}


void loop() {
  FastLED.setBrightness(200);
  motif2();
}

void motif2() {
  for (int j = 0; j < NUM_LEDS; j++) {
    leds[j] = CRGB(255,127,0);
    FastLED.show();
    delay(50);
   
  }
  delay(100);
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CRGB(0,0,0);
    FastLED.show();
    delay(50);
   
  }   
  delay(100);
}



question:
1. ON strip : RED led turn on first and cotinue to Green led turn on.
2. OFF strip: RED led turn off first and cointue to Green led turn off.

using Adafruit_NeoPixel.h and FastLED.h have same result.

why this is happen?

thank you in advance


UKHeliBob

Which Arduino board are you using and how are the LEDs powered ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Grumpy_Mike

That code looks like the code member sblantipodi was asking about do you have two accounts?

Go Up