kitesurfer1404 / WS2812FX

WS2812 FX Library for Arduino and ESP8266

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2 segments with only 2 leds?

huge-11 opened this issue · comments

Hello,
i have a project that only requires 2 leds and and 2 segments, so one led per segment.
How can i do that?
my current attempt:

            ws2812fx.setSegment(0,  0,  1, modeBLE, colors, StripSpeed, false);
            ws2812fx.setSegment(1, 1, 1, modeBLE,  colors, StripSpeed, false);

modeBLE and StripSpeed are variables int
and colors[] uint32_t

i get a strange behaviour on the second led? the first one is working fine.

i change the value of a variable and call ws2812fx.setSegment(1, 1, 1, modeBLE, colors, StripSpeed, false);

The setSegment() function takes the first and last LED index as parameters. In your case, with one LED per segment, it would look like this:

  uint32_t colors[] = {RED, GREEN, BLUE};

  // parameters: segment index, start led index, stop led index, mode, color, speed, reverse
  ws2812fx.setSegment(0, 0, 0, FX_MODE_STATIC, colors, 1000, false);
  ws2812fx.setSegment(1, 1, 1, FX_MODE_BLINK,  colors, 1000, false);

Ok, perfect thanks.