Working Code that does gets RGB Colors wrong some dont light at all

Hi I have a working completed project that I made using code that did the same thing on a smaller project but I have recently upgraded it to have more RGB's(I use the ws2812b) and an additional strand. These are controlled by buttons and they all work just fine. Only problem is there is some issue with the code that I can't debug, I am an entry level programmer and got a pro to write the code for me(lesept) but did'nt really need these colors (mainly red) in that project but now that I have made a new project with more RGB's the red is an issue. Here is a fritz of the project. Replace the ws2812b's in it with the small ones like a dime in size with only three wires a ground a data and a power.

and now here is the code.!

#include <FastLED.h>
#include <JC_Button.h>          // https://github.com/JChristensen/JC_Button
/*
   No copyright, use it at your own risks ;-) 
*/
// Define the arrays of leds
#define PIN_STRIP1 2
#define PIN_STRIP2 4
#define PIN_STRIP3 3
#define COLOR_ORDER RGB
#define LED_TYPE WS2812
#define NUM_LEDS 8
#define NUM_LEDS2 4
uint8_t max_bright = 255;
struct CRGB leds1[NUM_LEDS];
struct CRGB leds2[NUM_LEDS];
struct CRGB leds3[NUM_LEDS2];
//Colors for strip 1 using CRGB constants from FastLED library
int ledColor1[8] = {CRGB::Blue,CRGB::Blue,CRGB::Green,CRGB::Green,CRGB::Blue,CRGB::Blue,CRGB::Green,CRGB::Green}; // Color for strip 1
int ledColor2[8] = {CRGB::Purple,CRGB::Purple,CRGB::Purple,CRGB::Purple,CRGB::Blue,CRGB::Blue,CRGB::Blue,CRGB::Blue};  // Color for strip 2
int ledColor3[4] = {CRGB::Green,CRGB::HotPink,CRGB::Cyan,CRGB::Orange};

// Define buttons
const byte
  PIN_BUTTON1 (12),
  PIN_BUTTON2 (11),
  PIN_BUTTON3 (10),
  PIN_BUTTON_RESET (9);
Button BUTTON1(PIN_BUTTON1);
Button BUTTON2(PIN_BUTTON2);
Button BUTTON3(PIN_BUTTON3);
Button BUTTON_RESET(PIN_BUTTON_RESET);

// Global vars
int NumStrip1 = 0;
int NumStrip2 = 0;
int NumStrip3 = 0;

void setup() {
  LEDS.addLeds<LED_TYPE, PIN_STRIP1, COLOR_ORDER>(leds1, NUM_LEDS);
  LEDS.addLeds<LED_TYPE, PIN_STRIP2, COLOR_ORDER>(leds2, NUM_LEDS);
  LEDS.addLeds<LED_TYPE, PIN_STRIP3, COLOR_ORDER>(leds3, NUM_LEDS2);
  FastLED.setBrightness(max_bright);
  FastLED.clear();
  FastLED.show();
  BUTTON1.begin();
  BUTTON2.begin();
  BUTTON3.begin();
  BUTTON_RESET.begin();
}

void loop() {
  Checkbuttons();
}

void Checkbuttons()
{
  BUTTON1.read(); // read BUTTON1
  if (BUTTON1.wasReleased()) ChangeStrip1 ();
  BUTTON2.read(); // read BUTTON2
  if (BUTTON2.wasReleased()) ChangeStrip3 ();
  BUTTON3.read(); // read BUTTON3
  if (BUTTON3.wasReleased()) ChangeStrip2 ();
  BUTTON_RESET.read(); // read Reset BUTTON
  if (BUTTON_RESET.wasReleased()) ResetStrips ();
 
}

void ChangeStrip1 () {
  leds1[NumStrip1] = ledColor1[NumStrip1];
  NumStrip1 = min(NumStrip1 + 1, NUM_LEDS - 1);
  FastLED.show();
}

void ChangeStrip2 () {
  leds2[NumStrip2] = ledColor2[NumStrip2];
  NumStrip2 = min(NumStrip2 + 1, NUM_LEDS - 1);
  FastLED.show();
}

void ChangeStrip3 () {
  leds3[NumStrip3] = ledColor3[NumStrip3];
  NumStrip3 = min(NumStrip3 + 1, NUM_LEDS2 - 1);
  FastLED.show();
}

void ResetStrips () {
  FastLED.clear();
  NumStrip1 = 0;
  NumStrip2 = 0;
  NumStrip3 = 0;
  FastLED.show();
}

If any one can see why the color RED is not appearing that would be great. In general the RGB's are not doing the full spectrum but getting red is all i am after I need it for the Dreaded Mythos Phase. This is a phase tracker for the Game Arkham Horror 3rd Edition. Here is a picture of the almost completed project.

Any help getting these ws2812b geekcriet RGB's from Banggood lighting up RED would be greatly appreciated.

If you are using SMD diodes where you solder wires directly on to a 5x5mm LED, you should remember that this requires a 50nf ceramic capacitor for each LED. About the colors, you may try to change "COLOR_ORDER" to "GRB" but that depends on the spec sheet for the diodes.

Danois90:
If you are using SMD diodes where you solder wires directly on to a 5x5mm LED, you should remember that this requires a 50nf ceramic capacitor for each LED. About the colors, you may try to change "COLOR_ORDER" to "GRB" but that depends on the spec sheet for the diodes.

I can get them to turn red with other led code, but with this code, that uses buttons to advance the strand one at a time and have a master reset button the red comes out as a blank. I will try the GRB thing I believe I already have but will do it again. thanks for the interest. It turns the Green to orange and the red still is blank

I am sure the capacitor is built into the little board. I have made 4 or 5 projects that feature strands of these led's that all work with all colors except in this project with the buttons.

Not sure I completely understand what you're doing but...

You don't explicitly use "CRGB::Red" in your table of colours for each strip:

int ledColor1[8] = {CRGB::Blue,CRGB::Blue,CRGB::Green,CRGB::Green,CRGB::Blue,CRGB::Blue,CRGB::Green,CRGB::Green}; // Color for strip 1
int ledColor2[8] = {CRGB::Purple,CRGB::Purple,CRGB::Purple,CRGB::Purple,CRGB::Blue,CRGB::Blue,CRGB::Blue,CRGB::Blue};  // Color for strip 2
int ledColor3[4] = {CRGB::Green,CRGB::HotPink,CRGB::Cyan,CRGB::Orange};

If you get, say, purple (approx. rgb(128,0,128)) or orange (approx. rgb(255,127,80)) then you are getting the red LED to light, it's just diluted by other colours.

¯_(ツ)_/¯

Blackfin:
Not sure I completely understand what you're doing but...

You don't explicitly use "CRGB::Red" in your table of colours for each strip:

int ledColor1[8] = {CRGB::Blue,CRGB::Blue,CRGB::Green,CRGB::Green,CRGB::Blue,CRGB::Blue,CRGB::Green,CRGB::Green}; // Color for strip 1

int ledColor2[8] = {CRGB::Purple,CRGB::Purple,CRGB::Purple,CRGB::Purple,CRGB::Blue,CRGB::Blue,CRGB::Blue,CRGB::Blue};  // Color for strip 2
int ledColor3[4] = {CRGB::Green,CRGB::HotPink,CRGB::Cyan,CRGB::Orange};




If you get, say, purple (approx. rgb(128,0,128)) or orange (approx. rgb(255,127,80)) then you are getting the red LED to light, it's just diluted by other colours.

¯\_(ツ)_/¯

If I did they just turn up as blanks on the strips when it is lit by the button. If you think the solution is that easy just type red and boom I wouldnt be asking for help. and yes even with the number codes red still turns blank

Danois90:
If you are using SMD diodes where you solder wires directly on to a 5x5mm LED, you should remember that this requires a 50nf ceramic capacitor for each LED. About the colors, you may try to change "COLOR_ORDER" to "GRB" but that depends on the spec sheet for the diodes.

I turned the COLOR_ORDER to GBR and I now have red except I now dont have green, Problem solved I can work with that, thanks for the tip.

moJoeRedRog:
If I did they just turn up as blanks on the strips when it is lit by the button. If you think the solution is that easy just type red and boom I wouldnt be asking for help. and yes even with the number codes red still turns blank

You don't need to be a dick. Just trying to help.

Here's another thought:

You've declared your RGB variables to be ints:

int ledColor1[8] = {CRGB::Blue...

If you're losing the top value (the 'R' in RGB or the 'G' in GRB) perhaps it's because the colours may be truncated in an int.

I don't know if the RGB is coded 5:6:5 but if it's 8:8:8 as suggested by:

https://github.com/FastLED/FastLED/blob/master/colorpalettes.cpp

try a different, more appropriate type.

Here's another thought:

You've declared your RGB variables to be ints:

int ledColor1[8] = {CRGB::Blue...

If you're losing the top value (the 'R' in RGB or the 'G' in GRB) perhaps it's because the colours may be truncated in an int.

I don't know if the RGB is coded 5:6:5 but if it's 8:8:8 as suggested by:

https://github.com/FastLED/FastLED/blob/master/colorpalettes.cpp

That is it of course, for fastled you need to create an Array of th RGB type (3x byte) as is in all the examples that come with it. Fatsled does come with some easy to use functions for CSHV & rainbow, but yeah there are disadvantages over Adafruit_Neopixel.h

Blackfin:
You don't need to be a dick. Just trying to help.

Yea, adding @moJoeRedRog to the "Do Not Help" list.

gfvalvo:
Yea, adding @moJoeRedRog to the "Do Not Help" list.

gfvalvo:
Yea, adding @moJoeRedRog to the "Do Not Help" list.

Ya and I am adding gfvalvo to the do not ask list hahahahhahszaa

Blackfin:
You don't need to be a dick. Just trying to help.

Here's another thought:

You've declared your RGB variables to be ints:

int ledColor1[8] = {CRGB::Blue...

If you're losing the top value (the 'R' in RGB or the 'G' in GRB) perhaps it's because the colours may be truncated in an int.

I don't know if the RGB is coded 5:6:5 but if it's 8:8:8 as suggested by:

https://github.com/FastLED/FastLED/blob/master/colorpalettes.cpp

try a different, more appropriate type.

Thank you yes that was the problem I made them unsigned long's and changed the COLOR_ORDER to GRB and all works perfect. Thanks for the Tip and sorry if I was a bit salty 8^/

and here it is In all its glory the Arkham Horrorr 3rd edition Phase and move tracker. !

Thanks a bunch for all the help.

Those are Adafruit NeoPixels in your picture. All you need is their library and one output pin. Daisy chain them off that one pin and they are dead simple to program. You don't need any of ..

Oh well, if its already doing what you want.

-jim lee

moJoeRedRog:
I made them unsigned long's and changed the COLOR_ORDER to GRB and all works perfect.

Should do, but part of the Fastled.h is the definition of a struct called CRGB so you can create the array as such:CRGB leds[NUM_LEDS]; using 24-bits (rather then the 32 you are using now) But it's solved ! Great.

Here is a quick pick of the wiring in case any body is wondering how I wire up those RGB's