Skip to content

single WS2812 need to skip indexes to get address right #669

Description

@sylvix

Hi!

RGB modules are:
3 x FC-100 WS2812 (presumably) single board LEDs. They look like this:
FC-100

Also, it's searchable by "FC-100 RGB" on Google. In one place there's info that it's WS2811, other place it's WS2812.

Main setup:
Arduino Uno
Power comes from Arduino 5V and GND pins
Data wire is connected to pin 3
There is a 470 uF capacitor between 5V and GND (the only one I had), data line has 470 ohm resistor.
Everything is connected with wires on a breadboard chain-like, looking like that:

Chain-connection

Only my wires are longer, using prebuilt wires for arduino and breadboard (male-male).

Using FastLED 3.2.1, Arduino IDE 1.8.7 on Win10, nothing else.

When I use 1 LED, everything works perfectly, i.e. blink:

#include <FastLED.h>
#define NUM_LEDS 1
#define DATA_PIN 3
CRGB leds[NUM_LEDS];

void setup() {
    delay(2000);
    FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
}

void loop() {
  leds[0] = CRGB(255, 0, 0);
  FastLED.show();
  delay(500);
  leds[0] = CRGB(0, 0, 0);
  FastLED.show();
  delay(500);
}

Next, I'm adding one module. Trying to blink with two LEDS:

Changing
#define NUM_LEDS 2

Adding coloring to loop:

void loop() {
  leds[0] = CRGB(255, 0, 0);
  leds[1] = CRGB(0, 255, 0);
  FastLED.show();
  delay(500);
  leds[0] = CRGB(0, 0, 0);
  leds[1] = CRGB(0, 0, 0);
  FastLED.show();
  delay(500);
}

Now only the first one blinks, the second one is blue (default color when I power it on even without data line).

Ok, now the strange thing:

Increased NUM_LEDS to 3:


void loop() {
  leds[0] = CRGB(255, 0, 0);
  leds[2] = CRGB(0, 255, 0);
  FastLED.show();
  delay(500);
  leds[0] = CRGB(0, 0, 0);
  leds[2] = CRGB(0, 0, 0);
  FastLED.show();
  delay(500);
}

NOW it somehow works, but sometimes it goes off at random (blue, purple colors instead of turning off). So the first LED works correctly as leds[0], second LED works as leds[2], and leds[1] does nothing. If I connect third LED to the chain, set NUM_LEDS to 5 and use it as leds[4], it also kinda works.

Can anyone tell me what's the problem? Are my LEDs faulty? Or is timing wrong for those specific LEDs? I'm sure it's not normal to double array size and skip indexes by one to get the address right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions