Go Down

Topic: Different suppliers, unexpected results; Need help to fix RGB (Read 548 times) previous topic - next topic

techIV

Purchased 12volt versions of WS2811 addressable LED strips; however after applying the FASTLED 3.1 code, one side is green and the other is blue --same code driving both strips.  How do I go about correcting the RGB values?

Code: [Select]
#include <FastLED.h>

#define DATA_PIN    5
#define DATA_PIN    6
#define LED_TYPE    WS2811
#define COLOR_ORDER GRB
#define NUM_LEDS    10
CRGB leds[NUM_LEDS];

int photoresistor = A0;
int photovalue = 0;
int inputPin = 7; // D07 used for brightness selection


void setup()
{
  FastLED.addLeds<NEOPIXEL, 5>(leds, NUM_LEDS);
  FastLED.addLeds<NEOPIXEL, 6>(leds, NUM_LEDS);

  pinMode(photoresistor, INPUT);

  Serial.begin(9600);
}


//  //  ************************************************************************************************************
void iBright() {

  int iSetUp;
  pinMode(inputPin, INPUT_PULLUP);
  iSetUp = digitalRead(inputPin);   // Brightness Control

  if (iSetUp == HIGH)
  {
    FastLED.setBrightness(250);
  }
  else
  {
    FastLED.setBrightness(photovalue);
  }
}

//  //  ************************************************************************************************************
void LiteBulb () {

  iBright();


  for (int c = 0; c < NUM_LEDS; c++) {
    leds[c] = CRGB::Blue;
    FastLED.show();
  }
}

//  //  ************************************************************************************************************
void loop() {

  LiteBulb();

}

PaulS

Code: [Select]
void iBright() {

  int iSetUp;
  pinMode(inputPin, INPUT_PULLUP);

Why do you need to set the mode of the pin on every pass through loop()?

Why does loop() do nothing but call one function?

What does the manufacturer say? You have a hardware problem, not a software problem.

DrAzzy

Where's this 12v ws2811 strip from? Link? Those are normally 5v....
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

techIV

Why do you need to set the mode of the pin on every pass through loop()?

I am using a photo resistor to set the brightness level ALL the time unless the switch connected to pin 7 is open.

Why does loop() do nothing but call one function?

I DO have other functions using the switch-case but did not see the need to post those since the problem is strip related & not related to the code.

PaulS

Quote
I am using a photo resistor to set the brightness level ALL the time unless the switch connected to pin 7 is open.
What does that have to do with the mode of the pin? It is always input, isn't it? The mode should be set in setup(), not in loop() (or anything called from loop()).

techIV

What does that have to do with the mode of the pin? It is always input, isn't it? The mode should be set in setup(), not in loop() (or anything called from loop()).


... but that does not answer my question of correcting the RGB.  I'm wishing I had left out the photo resistor code.
And the supplier I had originally purchased the first set from amazon.com is no longer selling anything on amazon.com.
I had purchased 4 sets from a more recent supplier and they all work the same, only the original set has the problem.
I will agree it is hardware relate but it seems that this could be corrected with a software fix.

PaulS

Quote
I will agree it is hardware relate but it seems that this could be corrected with a software fix.
Possibly. You need to experiment with various colors to see what happens when the red intensity is high, and green and blue are 0. Then, see what happens when green is high and red and blue are low.

Perhaps it is just a matter of swapping two values. It could, though, be much more than that.

techIV

I like what FASTLED has to offer but NeoPixel will allow the user to control the RGB for 2 different strips ... still hoping someone else knows how to do this with FASTLED.

Code: [Select]
#include <Adafruit_NeoPixel.h>

#define PIN 5
#define PIN 6



int c = 0;

void setup()
{
  Serial.begin(9600);
}

Adafruit_NeoPixel strip = Adafruit_NeoPixel(20, 5, NEO_BRG + NEO_KHZ800);
Adafruit_NeoPixel strip_2 = Adafruit_NeoPixel(20, 6, NEO_GRB + NEO_KHZ800);



void loop() {
  strip.begin();
  strip_2.begin();

  for (c = 0; c < 20; c++) {

    strip.setPixelColor(c, 0, 200, 0);// green
    strip.show();
  }
  for (c = 0; c < 20; c++) {

    strip_2.setPixelColor(c, 0, 200, 0);// blue

    strip_2.show();
  }
}

techIV

Code: [Select]
#include <FastLED.h>

#define DATA_PIN    5
#define DATA_PIN    6
#define LED_TYPE    WS2811
#define NUM_LEDS    20
CRGB leds[NUM_LEDS];


void setup()
{
  FastLED.addLeds<WS2811, 5, BRG>(leds, NUM_LEDS); // default
  FastLED.addLeds<WS2811, 6, GRB>(leds, NUM_LEDS); //  BRG changed to display Green
  Serial.begin(9600);
}


void loop() {
 
}
  for (int c = 0; c < NUM_LEDS; c++) {
    leds[c] = CRGB::Blue;
    FastLED.show();
}

Go Up