Hi all,
I am having problems with WS2812B strips that I recently purchased. The first two systems I built work perfectly, but since then the next strips have not been able to turn on at all, and if . I can sometimes get a single LED light to turn on, and sometimes up to 10 but besides that nothing.
I have two code examples, the first one is designed to run just a single led strip, the second code is for two strips connected to the same arduino clone. There is a 330ohm resistor between the data line and the arduino.
Like I said, I have been able to run two sets of strips off of this code, so maybe it is the Arduino (i ran the blink test and it worked) that I am using or did I get a batch of defective strips? Seems unlikely...
Any information would be amazing I have been hitting my head against the wall for weeks trying to figure out what is wrong.
CODE #1
[code]
#include <FastLED.h>
#define LED_PIN 7
#define NUM_LEDS 153
#define MAX_BRIGHTNESS 50
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(0);
for (int i = 0; i <= 154; i++) {
leds[i] = CRGB(0xFFFFFF);
FastLED.show();
delay(0); }
}
void loop() {
while(true){
brightnessUp(50);
delay(100); //time that it stays at the max time
brightnessDown(50);
delay(10); //time that it stays off
}
}
void brightnessDown(int time){
for (int i=MAX_BRIGHTNESS; i >= 0; i--){
FastLED.setBrightness(i);
FastLED.show();
delay(time);
}
}
void brightnessUp(int time){
for (int i=0; i < MAX_BRIGHTNESS; i++){
FastLED.setBrightness(i);
FastLED.show();
delay(time);
}
}
CODE #2
[code]
#include <FastLED.h>
// A, 0 refers to the side leds, B, 1 refers to the background ones
#define LED_PIN_A 7
#define LED_PIN_B 8
#define NUM_LEDS_A 154
#define NUM_LEDS_B 125
#define LEDS_A_BRIGHT 255
#define LEDS_B_BRIGHT 255
CRGB leds_A[NUM_LEDS_A];
CRGB leds_B[NUM_LEDS_B];
CLEDController *controllers[2];
;
void setup() {
controllers[0] = &FastLED.addLeds<WS2812,LED_PIN_A>(leds_A, NUM_LEDS_A);
controllers[1] = &FastLED.addLeds<WS2812,LED_PIN_B>(leds_B, NUM_LEDS_B);
fill_solid(leds_A, NUM_LEDS_A, CRGB::LightCoral);
controllers[0]->showLeds(LEDS_A_BRIGHT);
// draw led data for the second strand into leds
fill_solid(leds_B, NUM_LEDS_B, CRGB::Bisque);
controllers[1]->showLeds(LEDS_B_BRIGHT);
}
void loop() {
// draw led data for the second strand into leds
fill_solid(leds_B, NUM_LEDS_B, CRGB::Bisque);
controllers[1]->showLeds(LEDS_B_BRIGHT);
brightnessDown(100);
delay(100);
brightnessUp(100);
delay(100);
}
void brightnessUp(int time){
int i = 0;
while(i < LEDS_A_BRIGHT){
controllers[0]->showLeds(i);
i++;
delay(time);}}
void brightnessDown(int time){
int i = LEDS_A_BRIGHT;
while(i > 0){
controllers[0]->showLeds(i);
i--;
delay(time);}}